Lines Matching refs:efx
35 static u8 *ef100_mcdi_buf(struct efx_nic *efx, u8 bufid, dma_addr_t *dma_addr) in ef100_mcdi_buf() argument
37 struct ef100_nic_data *nic_data = efx->nic_data; in ef100_mcdi_buf()
45 static int ef100_get_warm_boot_count(struct efx_nic *efx) in ef100_get_warm_boot_count() argument
49 efx_readd(efx, ®, efx_reg(efx, ER_GZ_MC_SFT_STATUS)); in ef100_get_warm_boot_count()
52 netif_err(efx, hw, efx->net_dev, "Hardware unavailable\n"); in ef100_get_warm_boot_count()
53 efx->state = STATE_DISABLED; in ef100_get_warm_boot_count()
61 static void ef100_mcdi_request(struct efx_nic *efx, in ef100_mcdi_request() argument
66 u8 *pdu = ef100_mcdi_buf(efx, 0, &dma_addr); in ef100_mcdi_request()
78 _efx_writed(efx, cpu_to_le32((u64)dma_addr >> 32), efx_reg(efx, ER_GZ_MC_DB_LWRD)); in ef100_mcdi_request()
79 _efx_writed(efx, cpu_to_le32((u32)dma_addr), efx_reg(efx, ER_GZ_MC_DB_HWRD)); in ef100_mcdi_request()
82 static bool ef100_mcdi_poll_response(struct efx_nic *efx) in ef100_mcdi_poll_response() argument
85 *(const efx_dword_t *)(ef100_mcdi_buf(efx, 0, NULL)); in ef100_mcdi_poll_response()
91 static void ef100_mcdi_read_response(struct efx_nic *efx, in ef100_mcdi_read_response() argument
95 const u8 *pdu = ef100_mcdi_buf(efx, 0, NULL); in ef100_mcdi_read_response()
100 static int ef100_mcdi_poll_reboot(struct efx_nic *efx) in ef100_mcdi_poll_reboot() argument
102 struct ef100_nic_data *nic_data = efx->nic_data; in ef100_mcdi_poll_reboot()
105 rc = ef100_get_warm_boot_count(efx); in ef100_mcdi_poll_reboot()
123 static void ef100_mcdi_reboot_detected(struct efx_nic *efx) in ef100_mcdi_reboot_detected() argument
129 static int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address) in ef100_get_mac_address() argument
137 rc = efx_mcdi_rpc(efx, MC_CMD_GET_MAC_ADDRESSES, NULL, 0, in ef100_get_mac_address()
149 static int efx_ef100_init_datapath_caps(struct efx_nic *efx) in efx_ef100_init_datapath_caps() argument
152 struct ef100_nic_data *nic_data = efx->nic_data; in efx_ef100_init_datapath_caps()
159 rc = efx_mcdi_rpc(efx, MC_CMD_GET_CAPABILITIES, NULL, 0, in efx_ef100_init_datapath_caps()
164 netif_err(efx, drv, efx->net_dev, in efx_ef100_init_datapath_caps()
181 rc = efx_mcdi_window_mode_to_stride(efx, vi_window_mode); in efx_ef100_init_datapath_caps()
186 efx->net_dev->features |= NETIF_F_TSO | NETIF_F_TSO6; in efx_ef100_init_datapath_caps()
187 efx->num_mac_stats = MCDI_WORD(outbuf, in efx_ef100_init_datapath_caps()
189 netif_dbg(efx, probe, efx->net_dev, in efx_ef100_init_datapath_caps()
191 efx->num_mac_stats); in efx_ef100_init_datapath_caps()
200 return efx_nic_alloc_buffer(channel->efx, &channel->eventq.buf, in ef100_ev_probe()
208 struct ef100_nic_data *nic_data = channel->efx->nic_data; in ef100_ev_init()
225 efx_writed(channel->efx, &evq_prime, in ef100_ev_read_ack()
226 efx_reg(channel->efx, ER_GZ_EVQ_INT_PRIME)); in ef100_ev_read_ack()
231 struct efx_nic *efx = channel->efx; in ef100_ev_process() local
243 nic_data = efx->nic_data; in ef100_ev_process()
256 netif_vdbg(efx, drv, efx->net_dev, in ef100_ev_process()
274 netif_info(efx, drv, efx->net_dev, in ef100_ev_process()
279 netif_info(efx, drv, efx->net_dev, in ef100_ev_process()
299 struct efx_nic *efx = context->efx; in ef100_msi_interrupt() local
301 netif_vdbg(efx, intr, efx->net_dev, in ef100_msi_interrupt()
304 if (likely(READ_ONCE(efx->irq_soft_enabled))) { in ef100_msi_interrupt()
306 if (context->index == efx->irq_level) in ef100_msi_interrupt()
307 efx->last_irq_cpu = raw_smp_processor_id(); in ef100_msi_interrupt()
310 efx_schedule_channel_irq(efx->channel[context->index]); in ef100_msi_interrupt()
316 static int ef100_phy_probe(struct efx_nic *efx) in ef100_phy_probe() argument
322 efx->phy_data = kzalloc(sizeof(struct efx_mcdi_phy_data), GFP_KERNEL); in ef100_phy_probe()
323 if (!efx->phy_data) in ef100_phy_probe()
326 rc = efx_mcdi_get_phy_cfg(efx, efx->phy_data); in ef100_phy_probe()
331 phy_data = efx->phy_data; in ef100_phy_probe()
333 efx->link_advertising); in ef100_phy_probe()
334 efx->fec_config = mcdi_fec_caps_to_ethtool(phy_data->supported_cap, in ef100_phy_probe()
338 efx->wanted_fc = EFX_FC_RX | EFX_FC_TX; in ef100_phy_probe()
340 efx->wanted_fc |= EFX_FC_AUTO; in ef100_phy_probe()
341 efx_link_set_wanted_fc(efx, efx->wanted_fc); in ef100_phy_probe()
346 rc = efx_mcdi_port_reconfigure(efx); in ef100_phy_probe()
348 netif_warn(efx, drv, efx->net_dev, in ef100_phy_probe()
354 static int ef100_filter_table_probe(struct efx_nic *efx) in ef100_filter_table_probe() argument
356 return efx_mcdi_filter_table_probe(efx, true); in ef100_filter_table_probe()
359 static int ef100_filter_table_up(struct efx_nic *efx) in ef100_filter_table_up() argument
363 rc = efx_mcdi_filter_add_vlan(efx, EFX_FILTER_VID_UNSPEC); in ef100_filter_table_up()
365 efx_mcdi_filter_table_down(efx); in ef100_filter_table_up()
369 rc = efx_mcdi_filter_add_vlan(efx, 0); in ef100_filter_table_up()
371 efx_mcdi_filter_del_vlan(efx, EFX_FILTER_VID_UNSPEC); in ef100_filter_table_up()
372 efx_mcdi_filter_table_down(efx); in ef100_filter_table_up()
378 static void ef100_filter_table_down(struct efx_nic *efx) in ef100_filter_table_down() argument
380 efx_mcdi_filter_del_vlan(efx, 0); in ef100_filter_table_down()
381 efx_mcdi_filter_del_vlan(efx, EFX_FILTER_VID_UNSPEC); in ef100_filter_table_down()
382 efx_mcdi_filter_table_down(efx); in ef100_filter_table_down()
387 static int ef100_reconfigure_mac(struct efx_nic *efx, bool mtu_only) in ef100_reconfigure_mac() argument
389 WARN_ON(!mutex_is_locked(&efx->mac_lock)); in ef100_reconfigure_mac()
391 efx_mcdi_filter_sync_rx_mode(efx); in ef100_reconfigure_mac()
393 if (mtu_only && efx_has_cap(efx, SET_MAC_ENHANCED)) in ef100_reconfigure_mac()
394 return efx_mcdi_set_mtu(efx); in ef100_reconfigure_mac()
395 return efx_mcdi_set_mac(efx); in ef100_reconfigure_mac()
420 static int ef100_reset(struct efx_nic *efx, enum reset_type reset_type) in ef100_reset() argument
424 dev_close(efx->net_dev); in ef100_reset()
427 netif_device_attach(efx->net_dev); in ef100_reset()
428 __clear_bit(reset_type, &efx->reset_pending); in ef100_reset()
429 rc = dev_open(efx->net_dev, NULL); in ef100_reset()
431 rc = efx_mcdi_reset(efx, reset_type); in ef100_reset()
435 netif_device_attach(efx->net_dev); in ef100_reset()
437 rc = dev_open(efx->net_dev, NULL); in ef100_reset()
535 static size_t ef100_describe_stats(struct efx_nic *efx, u8 *names) in ef100_describe_stats() argument
544 static size_t ef100_update_stats_common(struct efx_nic *efx, u64 *full_stats, in ef100_update_stats_common() argument
547 struct ef100_nic_data *nic_data = efx->nic_data; in ef100_update_stats_common()
588 static size_t ef100_update_stats(struct efx_nic *efx, in ef100_update_stats() argument
592 __le64 *mc_stats = kmalloc(array_size(efx->num_mac_stats, sizeof(__le64)), GFP_ATOMIC); in ef100_update_stats()
593 struct ef100_nic_data *nic_data = efx->nic_data; in ef100_update_stats()
603 efx_nic_copy_stats(efx, mc_stats); in ef100_update_stats()
609 return ef100_update_stats_common(efx, full_stats, core_stats); in ef100_update_stats()
612 static int efx_ef100_get_phys_port_id(struct efx_nic *efx, in efx_ef100_get_phys_port_id() argument
615 struct ef100_nic_data *nic_data = efx->nic_data; in efx_ef100_get_phys_port_id()
626 static int efx_ef100_irq_test_generate(struct efx_nic *efx) in efx_ef100_irq_test_generate() argument
632 MCDI_SET_DWORD(inbuf, TRIGGER_INTERRUPT_IN_INTR_LEVEL, efx->irq_level); in efx_ef100_irq_test_generate()
633 return efx_mcdi_rpc_quiet(efx, MC_CMD_TRIGGER_INTERRUPT, in efx_ef100_irq_test_generate()
642 struct efx_nic *efx = channel->efx; in efx_ef100_ev_test_generate() local
658 rc = efx_mcdi_rpc(efx, MC_CMD_DRIVER_EVENT, inbuf, sizeof(inbuf), in efx_ef100_ev_test_generate()
667 netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); in efx_ef100_ev_test_generate()
670 static unsigned int ef100_check_caps(const struct efx_nic *efx, in ef100_check_caps() argument
673 const struct ef100_nic_data *nic_data = efx->nic_data; in ef100_check_caps()
934 static int ef100_process_design_param(struct efx_nic *efx, in ef100_process_design_param() argument
937 struct ef100_nic_data *nic_data = efx->nic_data; in ef100_process_design_param()
964 netif_err(efx, probe, efx->net_dev, in ef100_process_design_param()
978 netif_err(efx, probe, efx->net_dev, in ef100_process_design_param()
987 efx->net_dev->gso_max_size = nic_data->tso_max_payload_len; in ef100_process_design_param()
991 efx->net_dev->gso_max_segs = nic_data->tso_max_payload_num_segs; in ef100_process_design_param()
998 netif_err(efx, probe, efx->net_dev, in ef100_process_design_param()
1020 netif_dbg(efx, probe, efx->net_dev, in ef100_process_design_param()
1035 netif_dbg(efx, probe, efx->net_dev, in ef100_process_design_param()
1042 static int ef100_check_design_params(struct efx_nic *efx) in ef100_check_design_params() argument
1050 efx_readd(efx, ®, ER_GZ_PARAMS_TLV_LEN); in ef100_check_design_params()
1052 netif_dbg(efx, probe, efx->net_dev, "%u bytes of design parameters\n", in ef100_check_design_params()
1055 efx_readd(efx, ®, ER_GZ_PARAMS_TLV + offset); in ef100_check_design_params()
1061 rc = ef100_process_design_param(efx, &reader); in ef100_check_design_params()
1074 netif_err(efx, probe, efx->net_dev, in ef100_check_design_params()
1078 netif_err(efx, probe, efx->net_dev, in ef100_check_design_params()
1089 static int ef100_probe_main(struct efx_nic *efx) in ef100_probe_main() argument
1091 unsigned int bar_size = resource_size(&efx->pci_dev->resource[efx->mem_bar]); in ef100_probe_main()
1092 struct net_device *net_dev = efx->net_dev; in ef100_probe_main()
1103 efx->nic_data = nic_data; in ef100_probe_main()
1104 nic_data->efx = efx; in ef100_probe_main()
1105 net_dev->features |= efx->type->offload_features; in ef100_probe_main()
1106 net_dev->hw_features |= efx->type->offload_features; in ef100_probe_main()
1115 rc = ef100_check_design_params(efx); in ef100_probe_main()
1117 netif_err(efx, probe, efx->net_dev, in ef100_probe_main()
1126 rc = efx_nic_alloc_buffer(efx, &nic_data->mcdi_buf, MCDI_BUF_LEN, in ef100_probe_main()
1136 rc = ef100_get_warm_boot_count(efx); in ef100_probe_main()
1150 _efx_writed(efx, cpu_to_le32(1), efx_reg(efx, ER_GZ_MC_DB_HWRD)); in ef100_probe_main()
1154 rc = efx_mcdi_init(efx); in ef100_probe_main()
1155 if (!rc && efx->mcdi->fn_flags & in ef100_probe_main()
1157 netif_info(efx, probe, efx->net_dev, in ef100_probe_main()
1164 rc = efx_mcdi_reset(efx, RESET_TYPE_ALL); in ef100_probe_main()
1168 rc = efx_mcdi_log_ctrl(efx, true, false, 0); in ef100_probe_main()
1172 rc = efx_get_pf_index(efx, &nic_data->pf_index); in ef100_probe_main()
1176 rc = efx_ef100_init_datapath_caps(efx); in ef100_probe_main()
1180 efx->max_vis = EF100_MAX_VIS; in ef100_probe_main()
1182 rc = efx_mcdi_port_get_number(efx); in ef100_probe_main()
1185 efx->port_num = rc; in ef100_probe_main()
1187 efx_mcdi_print_fwver(efx, fw_version, sizeof(fw_version)); in ef100_probe_main()
1188 netif_dbg(efx, drv, efx->net_dev, "Firmware version %s\n", fw_version); in ef100_probe_main()
1191 netif_info(efx, drv, efx->net_dev, "Firmware uses old event descriptors\n"); in ef100_probe_main()
1196 if (efx_has_cap(efx, UNSOL_EV_CREDIT_SUPPORTED)) { in ef100_probe_main()
1197 netif_info(efx, drv, efx->net_dev, "Firmware uses unsolicited-event credits\n"); in ef100_probe_main()
1202 rc = ef100_phy_probe(efx); in ef100_probe_main()
1206 down_write(&efx->filter_sem); in ef100_probe_main()
1207 rc = ef100_filter_table_probe(efx); in ef100_probe_main()
1208 up_write(&efx->filter_sem); in ef100_probe_main()
1212 netdev_rss_key_fill(efx->rss_context.rx_hash_key, in ef100_probe_main()
1213 sizeof(efx->rss_context.rx_hash_key)); in ef100_probe_main()
1216 efx_mcdi_push_default_indir_table(efx, efx->n_rx_channels); in ef100_probe_main()
1218 rc = ef100_register_netdev(efx); in ef100_probe_main()
1227 int ef100_probe_pf(struct efx_nic *efx) in ef100_probe_pf() argument
1229 struct net_device *net_dev = efx->net_dev; in ef100_probe_pf()
1231 int rc = ef100_probe_main(efx); in ef100_probe_pf()
1236 nic_data = efx->nic_data; in ef100_probe_pf()
1237 rc = ef100_get_mac_address(efx, net_dev->perm_addr); in ef100_probe_pf()
1250 int ef100_probe_vf(struct efx_nic *efx) in ef100_probe_vf() argument
1252 return ef100_probe_main(efx); in ef100_probe_vf()
1255 void ef100_remove(struct efx_nic *efx) in ef100_remove() argument
1257 struct ef100_nic_data *nic_data = efx->nic_data; in ef100_remove()
1259 ef100_unregister_netdev(efx); in ef100_remove()
1261 down_write(&efx->filter_sem); in ef100_remove()
1262 efx_mcdi_filter_table_remove(efx); in ef100_remove()
1263 up_write(&efx->filter_sem); in ef100_remove()
1264 efx_fini_channels(efx); in ef100_remove()
1265 kfree(efx->phy_data); in ef100_remove()
1266 efx->phy_data = NULL; in ef100_remove()
1267 efx_mcdi_detach(efx); in ef100_remove()
1268 efx_mcdi_fini(efx); in ef100_remove()
1270 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); in ef100_remove()
1272 efx->nic_data = NULL; in ef100_remove()