Lines Matching refs:pf

132 static void	 ixl_setup_ssctx(struct ixl_pf *pf);
361 ixl_allocate_pci_resources(struct ixl_pf *pf) in ixl_allocate_pci_resources() argument
363 device_t dev = iflib_get_dev(pf->vsi.ctx); in ixl_allocate_pci_resources()
364 struct i40e_hw *hw = &pf->hw; in ixl_allocate_pci_resources()
369 pf->pci_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in ixl_allocate_pci_resources()
372 if (!(pf->pci_mem)) { in ixl_allocate_pci_resources()
390 pf->osdep.mem_bus_space_tag = in ixl_allocate_pci_resources()
391 rman_get_bustag(pf->pci_mem); in ixl_allocate_pci_resources()
392 pf->osdep.mem_bus_space_handle = in ixl_allocate_pci_resources()
393 rman_get_bushandle(pf->pci_mem); in ixl_allocate_pci_resources()
394 pf->osdep.mem_bus_space_size = rman_get_size(pf->pci_mem); in ixl_allocate_pci_resources()
395 pf->osdep.flush_reg = I40E_GLGEN_STAT; in ixl_allocate_pci_resources()
396 pf->osdep.dev = dev; in ixl_allocate_pci_resources()
398 pf->hw.hw_addr = (u8 *) &pf->osdep.mem_bus_space_handle; in ixl_allocate_pci_resources()
399 pf->hw.back = &pf->osdep; in ixl_allocate_pci_resources()
405 ixl_setup_ssctx(struct ixl_pf *pf) in ixl_setup_ssctx() argument
407 if_softc_ctx_t scctx = pf->vsi.shared; in ixl_setup_ssctx()
408 struct i40e_hw *hw = &pf->hw; in ixl_setup_ssctx()
410 if (IXL_PF_IN_RECOVERY_MODE(pf)) { in ixl_setup_ssctx()
418 if (pf->vsi.enable_head_writeback) { in ixl_setup_ssctx()
436 scctx->isc_rss_table_size = pf->hw.func_caps.rss_table_size; in ixl_setup_ssctx()
444 struct ixl_pf *pf = (struct ixl_pf *)arg; in ixl_admin_timer() local
446 if (ixl_test_state(&pf->state, IXL_STATE_LINK_POLLING)) { in ixl_admin_timer()
447 struct i40e_hw *hw = &pf->hw; in ixl_admin_timer()
452 status = i40e_get_link_status(hw, &pf->link_up); in ixl_admin_timer()
454 ixl_clear_state(&pf->state, IXL_STATE_LINK_POLLING); in ixl_admin_timer()
457 device_printf(pf->dev, in ixl_admin_timer()
462 if (stime - pf->link_poll_start > IXL_PF_MAX_LINK_POLL) { in ixl_admin_timer()
463 device_printf(pf->dev, "Polling link status failed\n"); in ixl_admin_timer()
464 ixl_clear_state(&pf->state, IXL_STATE_LINK_POLLING); in ixl_admin_timer()
470 iflib_admin_intr_deferred(pf->vsi.ctx); in ixl_admin_timer()
473 callout_schedule(&pf->admin_timer, hz/2); in ixl_admin_timer()
477 ixl_attach_pre_recovery_mode(struct ixl_pf *pf) in ixl_attach_pre_recovery_mode() argument
479 struct ixl_vsi *vsi = &pf->vsi; in ixl_attach_pre_recovery_mode()
480 struct i40e_hw *hw = &pf->hw; in ixl_attach_pre_recovery_mode()
481 device_t dev = pf->dev; in ixl_attach_pre_recovery_mode()
488 ixl_configure_intr0_msix(pf); in ixl_attach_pre_recovery_mode()
492 ixl_setup_ssctx(pf); in ixl_attach_pre_recovery_mode()
501 struct ixl_pf *pf; in ixl_if_attach_pre() local
510 pf = iflib_get_softc(ctx); in ixl_if_attach_pre()
514 vsi = &pf->vsi; in ixl_if_attach_pre()
515 vsi->back = pf; in ixl_if_attach_pre()
516 pf->dev = dev; in ixl_if_attach_pre()
517 hw = &pf->hw; in ixl_if_attach_pre()
520 vsi->hw = &pf->hw; in ixl_if_attach_pre()
527 snprintf(pf->admin_mtx_name, sizeof(pf->admin_mtx_name), in ixl_if_attach_pre()
529 mtx_init(&pf->admin_mtx, pf->admin_mtx_name, NULL, MTX_DEF); in ixl_if_attach_pre()
530 callout_init_mtx(&pf->admin_timer, &pf->admin_mtx, 0); in ixl_if_attach_pre()
533 ixl_save_pf_tunables(pf); in ixl_if_attach_pre()
536 if (ixl_allocate_pci_resources(pf)) { in ixl_if_attach_pre()
546 error = ixl_pf_reset(pf); in ixl_if_attach_pre()
572 ixl_print_nvm_version(pf); in ixl_if_attach_pre()
595 if (IXL_PF_IN_RECOVERY_MODE(pf)) { in ixl_if_attach_pre()
596 error = ixl_attach_pre_recovery_mode(pf); in ixl_if_attach_pre()
606 error = ixl_get_hw_capabilities(pf); in ixl_if_attach_pre()
614 error = ixl_setup_hmc(pf); in ixl_if_attach_pre()
619 if (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 3)) || in ixl_if_attach_pre()
620 (pf->hw.aq.fw_maj_ver < 4)) { in ixl_if_attach_pre()
622 ixl_set_state(&pf->state, IXL_STATE_FW_LLDP_DISABLED); in ixl_if_attach_pre()
627 ixl_set_state(&pf->state, IXL_STATE_EEE_ENABLED); in ixl_if_attach_pre()
629 ixl_clear_state(&pf->state, IXL_STATE_EEE_ENABLED); in ixl_if_attach_pre()
654 ixl_set_state(&pf->state, in ixl_if_attach_pre()
657 ixl_clear_state(&pf->state, in ixl_if_attach_pre()
666 ixl_setup_ssctx(pf); in ixl_if_attach_pre()
672 ixl_shutdown_hmc(pf); in ixl_if_attach_pre()
676 ixl_free_pci_resources(pf); in ixl_if_attach_pre()
678 mtx_lock(&pf->admin_mtx); in ixl_if_attach_pre()
679 callout_stop(&pf->admin_timer); in ixl_if_attach_pre()
680 mtx_unlock(&pf->admin_mtx); in ixl_if_attach_pre()
681 mtx_destroy(&pf->admin_mtx); in ixl_if_attach_pre()
689 struct ixl_pf *pf; in ixl_if_attach_post() local
696 pf = iflib_get_softc(ctx); in ixl_if_attach_post()
700 vsi = &pf->vsi; in ixl_if_attach_post()
702 hw = &pf->hw; in ixl_if_attach_post()
709 if (ixl_setup_interface(dev, pf)) { in ixl_if_attach_post()
715 if (IXL_PF_IN_RECOVERY_MODE(pf)) { in ixl_if_attach_post()
718 ixl_configure_intr0_msix(pf); in ixl_if_attach_post()
722 ixl_add_sysctls_recovery_mode(pf); in ixl_if_attach_post()
725 mtx_lock(&pf->admin_mtx); in ixl_if_attach_post()
726 callout_reset(&pf->admin_timer, hz/2, ixl_admin_timer, pf); in ixl_if_attach_post()
727 mtx_unlock(&pf->admin_mtx); in ixl_if_attach_post()
731 error = ixl_switch_config(pf); in ixl_if_attach_post()
742 error = ixl_pf_qmgr_init(&pf->qmgr, hw->func_caps.num_tx_qp); in ixl_if_attach_post()
749 error = ixl_pf_qmgr_alloc_contiguous(&pf->qmgr, in ixl_if_attach_post()
750 max(vsi->num_rx_queues, vsi->num_tx_queues), &pf->qtag); in ixl_if_attach_post()
757 pf->qtag.num_allocated, pf->qtag.num_active); in ixl_if_attach_post()
760 error = ixl_attach_get_link_status(pf); in ixl_if_attach_post()
775 ixl_get_bus_info(pf); in ixl_if_attach_post()
779 ixl_configure_intr0_msix(pf); in ixl_if_attach_post()
784 ixl_set_initial_advertised_speeds(pf); in ixl_if_attach_post()
787 ixl_add_device_sysctls(pf); in ixl_if_attach_post()
788 ixl_pf_reset_stats(pf); in ixl_if_attach_post()
789 ixl_update_stats_counters(pf); in ixl_if_attach_post()
790 ixl_add_hw_stats(pf); in ixl_if_attach_post()
796 ixl_set_link(pf, ixl_test_state(&pf->state, IXL_STATE_LINK_ACTIVE_ON_DOWN)); in ixl_if_attach_post()
799 status = i40e_get_link_status(hw, &pf->link_up); in ixl_if_attach_post()
809 ixl_set_state(&pf->state, IXL_STATE_LINK_POLLING); in ixl_if_attach_post()
810 pf->link_poll_start = getsbinuptime(); in ixl_if_attach_post()
812 ixl_update_link_status(pf); in ixl_if_attach_post()
815 ixl_initialize_sriov(pf); in ixl_if_attach_post()
820 pf->iw_enabled = (pf->iw_msix > 0) ? true : false; in ixl_if_attach_post()
821 if (pf->iw_enabled) { in ixl_if_attach_post()
822 error = ixl_iw_pf_attach(pf); in ixl_if_attach_post()
834 pf->iw_enabled = false; in ixl_if_attach_post()
839 mtx_lock(&pf->admin_mtx); in ixl_if_attach_post()
840 callout_reset(&pf->admin_timer, hz/2, ixl_admin_timer, pf); in ixl_if_attach_post()
841 mtx_unlock(&pf->admin_mtx); in ixl_if_attach_post()
859 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_detach() local
860 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_detach()
861 struct i40e_hw *hw = &pf->hw; in ixl_if_detach()
862 device_t dev = pf->dev; in ixl_if_detach()
871 mtx_lock(&pf->admin_mtx); in ixl_if_detach()
872 callout_stop(&pf->admin_timer); in ixl_if_detach()
873 mtx_unlock(&pf->admin_mtx); in ixl_if_detach()
874 mtx_destroy(&pf->admin_mtx); in ixl_if_detach()
877 if (ixl_enable_iwarp && pf->iw_enabled) { in ixl_if_detach()
878 error = ixl_iw_pf_detach(pf); in ixl_if_detach()
889 ixl_shutdown_hmc(pf); in ixl_if_detach()
899 ixl_pf_qmgr_destroy(&pf->qmgr); in ixl_if_detach()
900 ixl_free_pci_resources(pf); in ixl_if_detach()
953 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_init() local
954 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_init()
955 struct i40e_hw *hw = &pf->hw; in ixl_if_init()
961 if (IXL_PF_IN_RECOVERY_MODE(pf)) in ixl_if_init()
968 if (!i40e_check_asq_alive(&pf->hw)) { in ixl_if_init()
970 ixl_teardown_hw_structs(pf); in ixl_if_init()
971 ixl_rebuild_hw_structs_after_reset(pf, false); in ixl_if_init()
1001 ixl_set_link(pf, true); in ixl_if_init()
1007 ixl_config_rss(pf); in ixl_if_init()
1011 ixl_configure_queue_intr_msix(pf); in ixl_if_init()
1012 ixl_configure_itr(pf); in ixl_if_init()
1014 ixl_configure_legacy(pf); in ixl_if_init()
1032 if (ixl_enable_iwarp && pf->iw_enabled) { in ixl_if_init()
1033 ret = ixl_iw_pf_init(pf); in ixl_if_init()
1044 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_stop() local
1046 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_stop()
1050 if (IXL_PF_IN_RECOVERY_MODE(pf)) in ixl_if_stop()
1056 if (ixl_enable_iwarp && pf->iw_enabled) in ixl_if_stop()
1057 ixl_iw_pf_stop(pf); in ixl_if_stop()
1061 ixl_disable_rings(pf, vsi, &pf->qtag); in ixl_if_stop()
1068 !ixl_test_state(&pf->state, IXL_STATE_LINK_ACTIVE_ON_DOWN)) in ixl_if_stop()
1069 ixl_set_link(pf, false); in ixl_if_stop()
1075 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_msix_intr_assign() local
1076 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_msix_intr_assign()
1088 ixl_msix_adminq, pf, 0, "aq"); in ixl_if_msix_intr_assign()
1098 iflib_softirq_alloc_generic(ctx, NULL, IFLIB_INTR_IOV, pf, 0, "iov"); in ixl_if_msix_intr_assign()
1151 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_enable_intr() local
1152 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_enable_intr()
1171 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_disable_intr() local
1172 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_disable_intr()
1189 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_rx_queue_intr_enable() local
1190 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_rx_queue_intr_enable()
1201 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_tx_queue_intr_enable() local
1202 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_tx_queue_intr_enable()
1213 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_tx_queues_alloc() local
1214 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_tx_queues_alloc()
1263 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_rx_queues_alloc() local
1264 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_rx_queues_alloc()
1306 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_queues_free() local
1307 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_queues_free()
1331 if (!IXL_PF_IN_RECOVERY_MODE(pf)) in ixl_if_queues_free()
1336 ixl_update_link_status(struct ixl_pf *pf) in ixl_update_link_status() argument
1338 struct ixl_vsi *vsi = &pf->vsi; in ixl_update_link_status()
1339 struct i40e_hw *hw = &pf->hw; in ixl_update_link_status()
1342 if (pf->link_up) { in ixl_update_link_status()
1347 ixl_link_up_msg(pf); in ixl_update_link_status()
1349 ixl_broadcast_link_state(pf); in ixl_update_link_status()
1357 ixl_broadcast_link_state(pf); in ixl_update_link_status()
1364 ixl_handle_lan_overflow_event(struct ixl_pf *pf, struct i40e_arq_event_info *e) in ixl_handle_lan_overflow_event() argument
1366 device_t dev = pf->dev; in ixl_handle_lan_overflow_event()
1378 ixl_process_adminq(struct ixl_pf *pf, u16 *pending) in ixl_process_adminq() argument
1382 struct i40e_hw *hw = &pf->hw; in ixl_process_adminq()
1383 device_t dev = pf->dev; in ixl_process_adminq()
1401 ixl_dbg(pf, IXL_DBG_AQ, in ixl_process_adminq()
1405 ixl_link_event(pf, &event); in ixl_process_adminq()
1409 ixl_handle_vf_msg(pf, &event); in ixl_process_adminq()
1417 ixl_handle_lan_overflow_event(pf, &event); in ixl_process_adminq()
1437 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_update_admin_status() local
1438 struct i40e_hw *hw = &pf->hw; in ixl_if_update_admin_status()
1441 if (IXL_PF_IS_RESETTING(pf)) in ixl_if_update_admin_status()
1442 ixl_handle_empr_reset(pf); in ixl_if_update_admin_status()
1449 if (!i40e_check_asq_alive(&pf->hw)) in ixl_if_update_admin_status()
1452 if (ixl_test_state(&pf->state, IXL_STATE_MDD_PENDING)) in ixl_if_update_admin_status()
1453 ixl_handle_mdd_event(pf); in ixl_if_update_admin_status()
1455 ixl_process_adminq(pf, &pending); in ixl_if_update_admin_status()
1456 ixl_update_link_status(pf); in ixl_if_update_admin_status()
1471 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_multi_set() local
1472 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_multi_set()
1496 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_mtu_set() local
1497 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_mtu_set()
1513 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_media_status() local
1514 struct i40e_hw *hw = &pf->hw; in ixl_if_media_status()
1521 if (!pf->link_up) { in ixl_if_media_status()
1668 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_promisc_set() local
1669 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_promisc_set()
1693 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_timer() local
1698 ixl_update_stats_counters(pf); in ixl_if_timer()
1704 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_vlan_register() local
1705 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_vlan_register()
1741 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_vlan_unregister() local
1742 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_vlan_unregister()
1767 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_get_counter() local
1768 struct ixl_vsi *vsi = &pf->vsi; in ixl_if_get_counter()
1806 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_vflr_handle() local
1808 ixl_handle_vflr(pf); in ixl_if_vflr_handle()
1815 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_i2c_req() local
1817 if (pf->read_i2c_byte == NULL) in ixl_if_i2c_req()
1821 if (pf->read_i2c_byte(pf, req->offset + i, in ixl_if_i2c_req()
1830 struct ixl_pf *pf = iflib_get_softc(ctx); in ixl_if_priv_ioctl() local
1849 error = ixl_handle_nvmupd_cmd(pf, ifd); in ixl_if_priv_ioctl()
1883 ixl_save_pf_tunables(struct ixl_pf *pf) in ixl_save_pf_tunables() argument
1885 device_t dev = pf->dev; in ixl_save_pf_tunables()
1889 pf->enable_tx_fc_filter = ixl_enable_tx_fc_filter; in ixl_save_pf_tunables()
1892 pf->recovery_mode = ixl_debug_recovery_mode; in ixl_save_pf_tunables()
1894 pf->dbg_mask = ixl_core_debug_mask; in ixl_save_pf_tunables()
1895 pf->hw.debug_mask = ixl_shared_debug_mask; in ixl_save_pf_tunables()
1896 pf->vsi.enable_head_writeback = !!(ixl_enable_head_writeback); in ixl_save_pf_tunables()
1897 pf->enable_vf_loopback = !!(ixl_enable_vf_loopback); in ixl_save_pf_tunables()
1899 pf->dynamic_rx_itr = ixl_dynamic_rx_itr; in ixl_save_pf_tunables()
1900 pf->dynamic_tx_itr = ixl_dynamic_tx_itr; in ixl_save_pf_tunables()
1904 pf->i2c_access_method = 0; in ixl_save_pf_tunables()
1906 pf->i2c_access_method = ixl_i2c_access_method; in ixl_save_pf_tunables()
1916 pf->tx_itr = IXL_ITR_4K; in ixl_save_pf_tunables()
1918 pf->tx_itr = ixl_tx_itr; in ixl_save_pf_tunables()
1928 pf->rx_itr = IXL_ITR_8K; in ixl_save_pf_tunables()
1930 pf->rx_itr = ixl_rx_itr; in ixl_save_pf_tunables()
1932 pf->fc = -1; in ixl_save_pf_tunables()
1944 pf->fc = ixl_flow_control; in ixl_save_pf_tunables()