Lines Matching full:pf
35 static void i40e_handle_reset_warning(struct i40e_pf *pf, bool lock_acquired);
38 static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit, bool lock_acquired);
39 static int i40e_setup_misc_vector(struct i40e_pf *pf);
40 static void i40e_determine_queue_usage(struct i40e_pf *pf);
41 static int i40e_setup_pf_filter_control(struct i40e_pf *pf);
42 static void i40e_prep_for_reset(struct i40e_pf *pf);
43 static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit,
45 static int i40e_reset(struct i40e_pf *pf);
46 static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired);
47 static int i40e_setup_misc_vector_for_recovery_mode(struct i40e_pf *pf);
48 static int i40e_restore_interrupt_scheme(struct i40e_pf *pf);
49 static bool i40e_check_recovery_mode(struct i40e_pf *pf);
50 static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw);
51 static void i40e_fdir_sb_setup(struct i40e_pf *pf);
53 static int i40e_get_capabilities(struct i40e_pf *pf,
55 static bool i40e_is_total_port_shutdown_enabled(struct i40e_pf *pf);
137 struct i40e_pf *pf = i40e_hw_to_pf(hw); in i40e_hw_to_dev() local
139 return &pf->pdev->dev; in i40e_hw_to_dev()
152 struct i40e_pf *pf = i40e_hw_to_pf(hw); in i40e_allocate_dma_mem() local
155 mem->va = dma_alloc_coherent(&pf->pdev->dev, mem->size, &mem->pa, in i40e_allocate_dma_mem()
170 struct i40e_pf *pf = i40e_hw_to_pf(hw); in i40e_free_dma_mem() local
172 dma_free_coherent(&pf->pdev->dev, mem->size, mem->va, mem->pa); in i40e_free_dma_mem()
215 * @pf: board private structure
222 static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, in i40e_get_lump() argument
229 dev_info(&pf->pdev->dev, in i40e_get_lump()
238 if (pile == pf->qp_pile && pf->vsi[id]->type == I40E_VSI_FDIR) { in i40e_get_lump()
240 dev_err(&pf->pdev->dev, in i40e_get_lump()
308 * @pf: the pf structure to search for the vsi
311 struct i40e_vsi *i40e_find_vsi_from_id(struct i40e_pf *pf, u16 id) in i40e_find_vsi_from_id() argument
316 i40e_pf_for_each_vsi(pf, i, vsi) in i40e_find_vsi_from_id()
325 * @pf: board private structure
329 void i40e_service_event_schedule(struct i40e_pf *pf) in i40e_service_event_schedule() argument
331 if ((!test_bit(__I40E_DOWN, pf->state) && in i40e_service_event_schedule()
332 !test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) || in i40e_service_event_schedule()
333 test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_service_event_schedule()
334 queue_work(i40e_wq, &pf->service_task); in i40e_service_event_schedule()
350 struct i40e_pf *pf = vsi->back; in i40e_tx_timeout() local
355 pf->tx_timeout_count++; in i40e_tx_timeout()
368 if (time_after(jiffies, (pf->tx_timeout_last_recovery + HZ*20))) in i40e_tx_timeout()
369 pf->tx_timeout_recovery_level = 1; /* reset after some time */ in i40e_tx_timeout()
371 (pf->tx_timeout_last_recovery + netdev->watchdog_timeo))) in i40e_tx_timeout()
375 if (test_and_set_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state)) in i40e_tx_timeout()
381 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_tx_timeout()
382 val = rd32(&pf->hw, in i40e_tx_timeout()
386 val = rd32(&pf->hw, I40E_PFINT_DYN_CTL0); in i40e_tx_timeout()
394 pf->tx_timeout_last_recovery = jiffies; in i40e_tx_timeout()
396 pf->tx_timeout_recovery_level, txqueue); in i40e_tx_timeout()
398 switch (pf->tx_timeout_recovery_level) { in i40e_tx_timeout()
400 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_tx_timeout()
403 set_bit(__I40E_CORE_RESET_REQUESTED, pf->state); in i40e_tx_timeout()
406 set_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state); in i40e_tx_timeout()
410 set_bit(__I40E_DOWN_REQUESTED, pf->state); in i40e_tx_timeout()
415 i40e_service_event_schedule(pf); in i40e_tx_timeout()
416 pf->tx_timeout_recovery_level++; in i40e_tx_timeout()
551 * i40e_pf_reset_stats - Reset all of the stats for the given PF
552 * @pf: the PF to be reset
554 void i40e_pf_reset_stats(struct i40e_pf *pf) in i40e_pf_reset_stats() argument
559 memset(&pf->stats, 0, sizeof(pf->stats)); in i40e_pf_reset_stats()
560 memset(&pf->stats_offsets, 0, sizeof(pf->stats_offsets)); in i40e_pf_reset_stats()
561 pf->stat_offsets_loaded = false; in i40e_pf_reset_stats()
563 i40e_pf_for_each_veb(pf, i, veb) { in i40e_pf_reset_stats()
570 pf->hw_csum_rx_error = 0; in i40e_pf_reset_stats()
716 struct i40e_pf *pf = vsi->back; in i40e_update_eth_stats() local
717 struct i40e_hw *hw = &pf->hw; in i40e_update_eth_stats()
778 struct i40e_pf *pf = veb->pf; in i40e_update_veb_stats() local
779 struct i40e_hw *hw = &pf->hw; in i40e_update_veb_stats()
864 struct i40e_pf *pf = vsi->back; in i40e_update_vsi_stats() local
881 test_bit(__I40E_CONFIG_BUSY, pf->state)) in i40e_update_vsi_stats()
991 /* pull in a couple PF stats if this is the main vsi */ in i40e_update_vsi_stats()
993 ns->rx_crc_errors = pf->stats.crc_errors; in i40e_update_vsi_stats()
994 ns->rx_errors = pf->stats.crc_errors + pf->stats.illegal_bytes; in i40e_update_vsi_stats()
995 ns->rx_length_errors = pf->stats.rx_length_errors; in i40e_update_vsi_stats()
1000 * i40e_update_pf_stats - Update the PF statistics counters.
1001 * @pf: the PF to be updated
1003 static void i40e_update_pf_stats(struct i40e_pf *pf) in i40e_update_pf_stats() argument
1005 struct i40e_hw_port_stats *osd = &pf->stats_offsets; in i40e_update_pf_stats()
1006 struct i40e_hw_port_stats *nsd = &pf->stats; in i40e_update_pf_stats()
1007 struct i40e_hw *hw = &pf->hw; in i40e_update_pf_stats()
1013 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1017 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1020 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1025 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1030 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1035 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1040 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1045 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1050 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1055 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1060 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1064 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1068 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1072 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1077 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1082 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1085 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1088 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1091 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1096 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1100 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1104 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1108 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1113 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1120 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1124 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1128 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1132 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1136 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1140 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1144 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1149 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1153 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1157 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1161 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1165 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1169 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1173 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1177 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1180 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1183 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1186 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1206 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1209 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1212 if (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags) && in i40e_update_pf_stats()
1213 !test_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state)) in i40e_update_pf_stats()
1218 if (test_bit(I40E_FLAG_FD_ATR_ENA, pf->flags) && in i40e_update_pf_stats()
1219 !test_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state)) in i40e_update_pf_stats()
1224 pf->stat_offsets_loaded = true; in i40e_update_pf_stats()
1235 struct i40e_pf *pf = vsi->back; in i40e_update_stats() local
1238 i40e_update_pf_stats(pf); in i40e_update_stats()
1484 struct i40e_pf *pf = vsi->back; in i40e_get_vf_new_vlan() local
1494 !test_bit(I40E_FLAG_VF_VLAN_PRUNING_ENA, pf->flags)); in i40e_get_vf_new_vlan()
1575 * @vsi: the PF Main VSI - inappropriate for any other VSI
1584 struct i40e_pf *pf = vsi->back; in i40e_rm_default_mac_filter() local
1586 /* Only appropriate for the PF main VSI */ in i40e_rm_default_mac_filter()
1595 i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL); in i40e_rm_default_mac_filter()
1603 i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL); in i40e_rm_default_mac_filter()
1803 struct i40e_pf *pf = vsi->back; in i40e_set_mac() local
1804 struct i40e_hw *hw = &pf->hw; in i40e_set_mac()
1810 if (test_bit(__I40E_DOWN, pf->state) || in i40e_set_mac()
1811 test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_set_mac()
1846 i40e_service_event_schedule(pf); in i40e_set_mac()
1860 struct i40e_pf *pf = vsi->back; in i40e_config_rss_aq() local
1861 struct i40e_hw *hw = &pf->hw; in i40e_config_rss_aq()
1869 dev_info(&pf->pdev->dev, in i40e_config_rss_aq()
1881 dev_info(&pf->pdev->dev, in i40e_config_rss_aq()
1897 struct i40e_pf *pf = vsi->back; in i40e_vsi_config_rss() local
1902 if (!test_bit(I40E_HW_CAP_RSS_AQ, pf->hw.caps)) in i40e_vsi_config_rss()
1905 vsi->rss_size = min_t(int, pf->alloc_rss_size, in i40e_vsi_config_rss()
1919 i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size); in i40e_vsi_config_rss()
2030 struct i40e_pf *pf = vsi->back; in i40e_vsi_setup_queue_map() local
2057 else if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_vsi_setup_queue_map()
2058 vsi->num_queue_pairs = pf->num_lan_msix; in i40e_vsi_setup_queue_map()
2077 dev_warn(&pf->pdev->dev, "DCB is enabled but no TC enabled, forcing TC0\n"); in i40e_vsi_setup_queue_map()
2082 i40e_pf_get_max_q_per_tc(pf)); in i40e_vsi_setup_queue_map()
2089 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_vsi_setup_queue_map()
2090 num_tc_qps = min_t(int, num_tc_qps, pf->num_lan_msix); in i40e_vsi_setup_queue_map()
2102 pf->flags) && in i40e_vsi_setup_queue_map()
2104 pf->flags)) || in i40e_vsi_setup_queue_map()
2106 qcount = min_t(int, pf->alloc_rss_size, in i40e_vsi_setup_queue_map()
2476 * @pf: board private structure
2479 * There are different ways of setting promiscuous mode on a PF depending on
2483 static int i40e_set_promiscuous(struct i40e_pf *pf, bool promisc) in i40e_set_promiscuous() argument
2485 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_set_promiscuous()
2486 struct i40e_hw *hw = &pf->hw; in i40e_set_promiscuous()
2490 i40e_pf_get_main_veb(pf) && in i40e_set_promiscuous()
2491 !test_bit(I40E_FLAG_MFP_ENA, pf->flags)) { in i40e_set_promiscuous()
2506 dev_info(&pf->pdev->dev, in i40e_set_promiscuous()
2518 dev_info(&pf->pdev->dev, in i40e_set_promiscuous()
2528 dev_info(&pf->pdev->dev, in i40e_set_promiscuous()
2536 pf->cur_promisc = promisc; in i40e_set_promiscuous()
2558 char vsi_name[16] = "PF"; in i40e_sync_vsi_filters()
2562 struct i40e_pf *pf; in i40e_sync_vsi_filters() local
2577 pf = vsi->back; in i40e_sync_vsi_filters()
2635 else if (pf->vf) in i40e_sync_vsi_filters()
2638 vlan_filters, pf->vf[vsi->vf_id].trusted); in i40e_sync_vsi_filters()
2801 dev_info(&pf->pdev->dev, in i40e_sync_vsi_filters()
2809 if (vsi->type == I40E_VSI_SRIOV && pf->vf && in i40e_sync_vsi_filters()
2810 !pf->vf[vsi->vf_id].trusted) { in i40e_sync_vsi_filters()
2835 dev_info(&pf->pdev->dev, in i40e_sync_vsi_filters()
2841 dev_info(&pf->pdev->dev, "%s allmulti mode.\n", in i40e_sync_vsi_filters()
2851 aq_ret = i40e_set_promiscuous(pf, cur_promisc); in i40e_sync_vsi_filters()
2855 dev_info(&pf->pdev->dev, in i40e_sync_vsi_filters()
2886 * @pf: board private structure
2888 static void i40e_sync_filters_subtask(struct i40e_pf *pf) in i40e_sync_filters_subtask() argument
2893 if (!pf) in i40e_sync_filters_subtask()
2895 if (!test_and_clear_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state)) in i40e_sync_filters_subtask()
2897 if (test_bit(__I40E_VF_DISABLE, pf->state)) { in i40e_sync_filters_subtask()
2898 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_sync_filters_subtask()
2902 i40e_pf_for_each_vsi(pf, v, vsi) { in i40e_sync_filters_subtask()
2910 pf->state); in i40e_sync_filters_subtask()
2960 struct i40e_pf *pf = vsi->back; in i40e_change_mtu() local
2975 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_change_mtu()
2976 set_bit(__I40E_CLIENT_L2_CHANGE, pf->state); in i40e_change_mtu()
2989 struct i40e_pf *pf = np->vsi->back; in i40e_ioctl() local
2993 return i40e_ptp_get_ts_config(pf, ifr); in i40e_ioctl()
2995 return i40e_ptp_set_ts_config(pf, ifr); in i40e_ioctl()
3831 * @pf: Pointer to the targeted PF
3835 static void i40e_reset_fdir_filter_cnt(struct i40e_pf *pf) in i40e_reset_fdir_filter_cnt() argument
3837 pf->fd_tcp4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3838 pf->fd_udp4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3839 pf->fd_sctp4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3840 pf->fd_ip4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3841 pf->fd_tcp6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3842 pf->fd_udp6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3843 pf->fd_sctp6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3844 pf->fd_ip6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3857 struct i40e_pf *pf = vsi->back; in i40e_fdir_filter_restore() local
3860 if (!test_bit(I40E_FLAG_FD_SB_ENA, pf->flags)) in i40e_fdir_filter_restore()
3864 i40e_reset_fdir_filter_cnt(pf); in i40e_fdir_filter_restore()
3867 &pf->fdir_filter_list, fdir_node) { in i40e_fdir_filter_restore()
3897 struct i40e_pf *pf = vsi->back; in i40e_vsi_configure_msix() local
3898 struct i40e_hw *hw = &pf->hw; in i40e_vsi_configure_msix()
3984 * @pf: pointer to private device data structure
3986 static void i40e_enable_misc_int_causes(struct i40e_pf *pf) in i40e_enable_misc_int_causes() argument
3988 struct i40e_hw *hw = &pf->hw; in i40e_enable_misc_int_causes()
4004 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags)) in i40e_enable_misc_int_causes()
4007 if (test_bit(I40E_FLAG_PTP_ENA, pf->flags)) in i40e_enable_misc_int_causes()
4028 struct i40e_pf *pf = vsi->back; in i40e_configure_msi_and_legacy() local
4029 struct i40e_hw *hw = &pf->hw; in i40e_configure_msi_and_legacy()
4041 i40e_enable_misc_int_causes(pf); in i40e_configure_msi_and_legacy()
4065 * @pf: board private structure
4067 void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf) in i40e_irq_dynamic_disable_icr0() argument
4069 struct i40e_hw *hw = &pf->hw; in i40e_irq_dynamic_disable_icr0()
4078 * @pf: board private structure
4080 void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf) in i40e_irq_dynamic_enable_icr0() argument
4082 struct i40e_hw *hw = &pf->hw; in i40e_irq_dynamic_enable_icr0()
4147 struct i40e_pf *pf = vsi->back; in i40e_vsi_request_irq_msix() local
4158 irq_num = pf->msix_entries[base + vector].vector; in i40e_vsi_request_irq_msix()
4180 dev_info(&pf->pdev->dev, in i40e_vsi_request_irq_msix()
4206 irq_num = pf->msix_entries[base + vector].vector; in i40e_vsi_request_irq_msix()
4220 struct i40e_pf *pf = vsi->back; in i40e_vsi_disable_irq() local
4221 struct i40e_hw *hw = &pf->hw; in i40e_vsi_disable_irq()
4243 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_vsi_disable_irq()
4250 synchronize_irq(pf->msix_entries[i + base].vector); in i40e_vsi_disable_irq()
4256 synchronize_irq(pf->pdev->irq); in i40e_vsi_disable_irq()
4266 struct i40e_pf *pf = vsi->back; in i40e_vsi_enable_irq() local
4269 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_vsi_enable_irq()
4273 i40e_irq_dynamic_enable_icr0(pf); in i40e_vsi_enable_irq()
4276 i40e_flush(&pf->hw); in i40e_vsi_enable_irq()
4282 * @pf: board private structure
4284 static void i40e_free_misc_vector(struct i40e_pf *pf) in i40e_free_misc_vector() argument
4287 wr32(&pf->hw, I40E_PFINT_ICR0_ENA, 0); in i40e_free_misc_vector()
4288 i40e_flush(&pf->hw); in i40e_free_misc_vector()
4290 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags) && pf->msix_entries) { in i40e_free_misc_vector()
4291 free_irq(pf->msix_entries[0].vector, pf); in i40e_free_misc_vector()
4292 clear_bit(__I40E_MISC_IRQ_REQUESTED, pf->state); in i40e_free_misc_vector()
4307 struct i40e_pf *pf = (struct i40e_pf *)data; in i40e_intr() local
4308 struct i40e_hw *hw = &pf->hw; in i40e_intr()
4323 pf->sw_int_count++; in i40e_intr()
4325 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags) && in i40e_intr()
4328 dev_dbg(&pf->pdev->dev, "cleared PE_CRITERR\n"); in i40e_intr()
4329 set_bit(__I40E_CORE_RESET_REQUESTED, pf->state); in i40e_intr()
4334 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_intr()
4343 if (!test_bit(__I40E_DOWN, pf->state)) in i40e_intr()
4349 set_bit(__I40E_ADMINQ_EVENT_PENDING, pf->state); in i40e_intr()
4350 i40e_debug(&pf->hw, I40E_DEBUG_NVM, "AdminQ event\n"); in i40e_intr()
4355 set_bit(__I40E_MDD_EVENT_PENDING, pf->state); in i40e_intr()
4360 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) { in i40e_intr()
4367 set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_intr()
4372 if (!test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_intr()
4373 set_bit(__I40E_RESET_INTR_RECEIVED, pf->state); in i40e_intr()
4378 pf->corer_count++; in i40e_intr()
4380 pf->globr_count++; in i40e_intr()
4382 pf->empr_count++; in i40e_intr()
4383 set_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state); in i40e_intr()
4389 dev_info(&pf->pdev->dev, "HMC error interrupt\n"); in i40e_intr()
4390 dev_info(&pf->pdev->dev, "HMC error info 0x%x, HMC error data 0x%x\n", in i40e_intr()
4399 schedule_work(&pf->ptp_extts0_work); in i40e_intr()
4402 i40e_ptp_tx_hwtstamp(pf); in i40e_intr()
4413 dev_info(&pf->pdev->dev, "unhandled interrupt icr0=0x%08x\n", in i40e_intr()
4418 dev_info(&pf->pdev->dev, "device will be reset\n"); in i40e_intr()
4419 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_intr()
4420 i40e_service_event_schedule(pf); in i40e_intr()
4429 if (!test_bit(__I40E_DOWN, pf->state) || in i40e_intr()
4430 test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_intr()
4431 i40e_service_event_schedule(pf); in i40e_intr()
4432 i40e_irq_dynamic_enable_icr0(pf); in i40e_intr()
4627 struct i40e_pf *pf = vsi->back; in i40e_vsi_request_irq() local
4630 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_vsi_request_irq()
4632 else if (test_bit(I40E_FLAG_MSI_ENA, pf->flags)) in i40e_vsi_request_irq()
4633 err = request_irq(pf->pdev->irq, i40e_intr, 0, in i40e_vsi_request_irq()
4634 pf->int_name, pf); in i40e_vsi_request_irq()
4636 err = request_irq(pf->pdev->irq, i40e_intr, IRQF_SHARED, in i40e_vsi_request_irq()
4637 pf->int_name, pf); in i40e_vsi_request_irq()
4640 dev_info(&pf->pdev->dev, "request_irq failed, Error %d\n", err); in i40e_vsi_request_irq()
4657 struct i40e_pf *pf = vsi->back; in i40e_netpoll() local
4664 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_netpoll()
4668 i40e_intr(pf->pdev->irq, netdev); in i40e_netpoll()
4676 * i40e_pf_txq_wait - Wait for a PF's Tx queue to be enabled or disabled
4677 * @pf: the PF being configured
4678 * @pf_q: the PF queue
4681 * This routine will wait for the given Tx queue of the PF to reach the
4686 static int i40e_pf_txq_wait(struct i40e_pf *pf, int pf_q, bool enable) in i40e_pf_txq_wait() argument
4692 tx_reg = rd32(&pf->hw, I40E_QTX_ENA(pf_q)); in i40e_pf_txq_wait()
4706 * @pf: the PF structure
4707 * @pf_q: the PF queue to configure
4714 static void i40e_control_tx_q(struct i40e_pf *pf, int pf_q, bool enable) in i40e_control_tx_q() argument
4716 struct i40e_hw *hw = &pf->hw; in i40e_control_tx_q()
4721 i40e_pre_tx_queue_cfg(&pf->hw, pf_q, enable); in i40e_control_tx_q()
4751 * @pf: the PF structure
4752 * @pf_q: the PF queue to configure
4756 int i40e_control_wait_tx_q(int seid, struct i40e_pf *pf, int pf_q, in i40e_control_wait_tx_q() argument
4761 i40e_control_tx_q(pf, pf_q, enable); in i40e_control_wait_tx_q()
4764 ret = i40e_pf_txq_wait(pf, pf_q, enable); in i40e_control_wait_tx_q()
4766 dev_info(&pf->pdev->dev, in i40e_control_wait_tx_q()
4781 struct i40e_pf *pf = vsi->back; in i40e_vsi_enable_tx() local
4786 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_vsi_enable_tx()
4795 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_vsi_enable_tx()
4805 * i40e_pf_rxq_wait - Wait for a PF's Rx queue to be enabled or disabled
4806 * @pf: the PF being configured
4807 * @pf_q: the PF queue
4810 * This routine will wait for the given Rx queue of the PF to reach the
4815 static int i40e_pf_rxq_wait(struct i40e_pf *pf, int pf_q, bool enable) in i40e_pf_rxq_wait() argument
4821 rx_reg = rd32(&pf->hw, I40E_QRX_ENA(pf_q)); in i40e_pf_rxq_wait()
4835 * @pf: the PF structure
4836 * @pf_q: the PF queue to configure
4843 static void i40e_control_rx_q(struct i40e_pf *pf, int pf_q, bool enable) in i40e_control_rx_q() argument
4845 struct i40e_hw *hw = &pf->hw; in i40e_control_rx_q()
4872 * @pf: the PF structure
4880 int i40e_control_wait_rx_q(struct i40e_pf *pf, int pf_q, bool enable) in i40e_control_wait_rx_q() argument
4884 i40e_control_rx_q(pf, pf_q, enable); in i40e_control_wait_rx_q()
4887 ret = i40e_pf_rxq_wait(pf, pf_q, enable); in i40e_control_wait_rx_q()
4900 struct i40e_pf *pf = vsi->back; in i40e_vsi_enable_rx() local
4905 ret = i40e_control_wait_rx_q(pf, pf_q, true); in i40e_vsi_enable_rx()
4907 dev_info(&pf->pdev->dev, in i40e_vsi_enable_rx()
4942 struct i40e_pf *pf = vsi->back; in i40e_vsi_stop_rings() local
4952 i40e_pre_tx_queue_cfg(&pf->hw, pf_q, false); in i40e_vsi_stop_rings()
4956 i40e_control_rx_q(pf, pf_q, false); in i40e_vsi_stop_rings()
4960 wr32(&pf->hw, I40E_QTX_ENA(pf_q), 0); in i40e_vsi_stop_rings()
4978 struct i40e_pf *pf = vsi->back; in i40e_vsi_stop_rings_no_wait() local
4983 i40e_control_tx_q(pf, pf_q, false); in i40e_vsi_stop_rings_no_wait()
4984 i40e_control_rx_q(pf, pf_q, false); in i40e_vsi_stop_rings_no_wait()
4994 struct i40e_pf *pf = vsi->back; in i40e_vsi_free_irq() local
4995 struct i40e_hw *hw = &pf->hw; in i40e_vsi_free_irq()
5000 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_vsi_free_irq()
5013 irq_num = pf->msix_entries[vector].vector; in i40e_vsi_free_irq()
5073 free_irq(pf->pdev->irq, pf); in i40e_vsi_free_irq()
5156 * @pf: board private structure
5158 static void i40e_reset_interrupt_capability(struct i40e_pf *pf) in i40e_reset_interrupt_capability() argument
5161 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_reset_interrupt_capability()
5162 pci_disable_msix(pf->pdev); in i40e_reset_interrupt_capability()
5163 kfree(pf->msix_entries); in i40e_reset_interrupt_capability()
5164 pf->msix_entries = NULL; in i40e_reset_interrupt_capability()
5165 kfree(pf->irq_pile); in i40e_reset_interrupt_capability()
5166 pf->irq_pile = NULL; in i40e_reset_interrupt_capability()
5167 } else if (test_bit(I40E_FLAG_MSI_ENA, pf->flags)) { in i40e_reset_interrupt_capability()
5168 pci_disable_msi(pf->pdev); in i40e_reset_interrupt_capability()
5170 clear_bit(I40E_FLAG_MSI_ENA, pf->flags); in i40e_reset_interrupt_capability()
5171 clear_bit(I40E_FLAG_MSIX_ENA, pf->flags); in i40e_reset_interrupt_capability()
5176 * @pf: board private structure
5181 static void i40e_clear_interrupt_scheme(struct i40e_pf *pf) in i40e_clear_interrupt_scheme() argument
5186 if (test_bit(__I40E_MISC_IRQ_REQUESTED, pf->state)) in i40e_clear_interrupt_scheme()
5187 i40e_free_misc_vector(pf); in i40e_clear_interrupt_scheme()
5189 i40e_put_lump(pf->irq_pile, pf->iwarp_base_vector, in i40e_clear_interrupt_scheme()
5192 i40e_put_lump(pf->irq_pile, 0, I40E_PILE_VALID_BIT-1); in i40e_clear_interrupt_scheme()
5194 i40e_pf_for_each_vsi(pf, i, vsi) in i40e_clear_interrupt_scheme()
5197 i40e_reset_interrupt_capability(pf); in i40e_clear_interrupt_scheme()
5244 struct i40e_pf *pf = vsi->back; in i40e_vsi_close() local
5251 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_vsi_close()
5252 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_vsi_close()
5253 set_bit(__I40E_CLIENT_RESET, pf->state); in i40e_vsi_close()
5288 * i40e_pf_quiesce_all_vsi - Pause all VSIs on a PF
5289 * @pf: the PF
5291 static void i40e_pf_quiesce_all_vsi(struct i40e_pf *pf) in i40e_pf_quiesce_all_vsi() argument
5296 i40e_pf_for_each_vsi(pf, v, vsi) in i40e_pf_quiesce_all_vsi()
5301 * i40e_pf_unquiesce_all_vsi - Resume all VSIs on a PF
5302 * @pf: the PF
5304 static void i40e_pf_unquiesce_all_vsi(struct i40e_pf *pf) in i40e_pf_unquiesce_all_vsi() argument
5309 i40e_pf_for_each_vsi(pf, v, vsi) in i40e_pf_unquiesce_all_vsi()
5321 struct i40e_pf *pf = vsi->back; in i40e_vsi_wait_queues_disabled() local
5327 ret = i40e_pf_txq_wait(pf, pf_q, false); in i40e_vsi_wait_queues_disabled()
5329 dev_info(&pf->pdev->dev, in i40e_vsi_wait_queues_disabled()
5339 ret = i40e_pf_txq_wait(pf, pf_q + vsi->alloc_queue_pairs, in i40e_vsi_wait_queues_disabled()
5342 dev_info(&pf->pdev->dev, in i40e_vsi_wait_queues_disabled()
5349 ret = i40e_pf_rxq_wait(pf, pf_q, false); in i40e_vsi_wait_queues_disabled()
5351 dev_info(&pf->pdev->dev, in i40e_vsi_wait_queues_disabled()
5363 * i40e_pf_wait_queues_disabled - Wait for all queues of PF VSIs to be disabled
5364 * @pf: the PF
5367 * VSIs that are managed by this PF.
5369 static int i40e_pf_wait_queues_disabled(struct i40e_pf *pf) in i40e_pf_wait_queues_disabled() argument
5374 i40e_pf_for_each_vsi(pf, v, vsi) { in i40e_pf_wait_queues_disabled()
5387 * @pf: pointer to PF
5389 * Get TC map for ISCSI PF type that will include iSCSI TC
5392 static u8 i40e_get_iscsi_tc_map(struct i40e_pf *pf) in i40e_get_iscsi_tc_map() argument
5395 struct i40e_hw *hw = &pf->hw; in i40e_get_iscsi_tc_map()
5477 * @pf: PF being queried
5482 static u8 i40e_mqprio_get_enabled_tc(struct i40e_pf *pf) in i40e_mqprio_get_enabled_tc() argument
5484 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_mqprio_get_enabled_tc()
5494 * i40e_pf_get_num_tc - Get enabled traffic classes for PF
5495 * @pf: PF being queried
5497 * Return number of traffic classes enabled for the given PF
5499 static u8 i40e_pf_get_num_tc(struct i40e_pf *pf) in i40e_pf_get_num_tc() argument
5504 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_pf_get_num_tc()
5505 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_pf_get_num_tc()
5511 if (!test_bit(I40E_FLAG_DCB_ENA, pf->flags)) in i40e_pf_get_num_tc()
5515 if (!test_bit(I40E_FLAG_MFP_ENA, pf->flags)) in i40e_pf_get_num_tc()
5516 return i40e_dcb_get_num_tc(&pf->hw.local_dcbx_config); in i40e_pf_get_num_tc()
5518 /* MFP mode return count of enabled TCs for this PF */ in i40e_pf_get_num_tc()
5519 if (pf->hw.func_caps.iscsi) in i40e_pf_get_num_tc()
5520 enabled_tc = i40e_get_iscsi_tc_map(pf); in i40e_pf_get_num_tc()
5533 * @pf: PF being queried
5535 * Return a bitmap for enabled traffic classes for this PF.
5537 static u8 i40e_pf_get_tc_map(struct i40e_pf *pf) in i40e_pf_get_tc_map() argument
5539 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_pf_get_tc_map()
5540 return i40e_mqprio_get_enabled_tc(pf); in i40e_pf_get_tc_map()
5542 /* If neither MQPRIO nor DCB is enabled for this PF then just return in i40e_pf_get_tc_map()
5545 if (!test_bit(I40E_FLAG_DCB_ENA, pf->flags)) in i40e_pf_get_tc_map()
5548 /* SFP mode we want PF to be enabled for all TCs */ in i40e_pf_get_tc_map()
5549 if (!test_bit(I40E_FLAG_MFP_ENA, pf->flags)) in i40e_pf_get_tc_map()
5550 return i40e_dcb_get_enabled_tc(&pf->hw.local_dcbx_config); in i40e_pf_get_tc_map()
5552 /* MFP enabled and iSCSI PF type */ in i40e_pf_get_tc_map()
5553 if (pf->hw.func_caps.iscsi) in i40e_pf_get_tc_map()
5554 return i40e_get_iscsi_tc_map(pf); in i40e_pf_get_tc_map()
5569 struct i40e_pf *pf = vsi->back; in i40e_vsi_get_bw_info() local
5570 struct i40e_hw *hw = &pf->hw; in i40e_vsi_get_bw_info()
5578 dev_info(&pf->pdev->dev, in i40e_vsi_get_bw_info()
5579 "couldn't get PF vsi bw config, err %pe aq_err %s\n", in i40e_vsi_get_bw_info()
5581 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vsi_get_bw_info()
5589 dev_info(&pf->pdev->dev, in i40e_vsi_get_bw_info()
5590 "couldn't get PF vsi ets bw config, err %pe aq_err %s\n", in i40e_vsi_get_bw_info()
5592 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vsi_get_bw_info()
5597 dev_info(&pf->pdev->dev, in i40e_vsi_get_bw_info()
5631 struct i40e_pf *pf = vsi->back; in i40e_vsi_configure_bw_alloc() local
5636 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_vsi_configure_bw_alloc()
5638 if (!vsi->mqprio_qopt.qopt.hw && !test_bit(I40E_FLAG_DCB_ENA, pf->flags)) { in i40e_vsi_configure_bw_alloc()
5641 dev_info(&pf->pdev->dev, in i40e_vsi_configure_bw_alloc()
5651 ret = i40e_aq_config_vsi_tc_bw(&pf->hw, vsi->seid, &bw_data, NULL); in i40e_vsi_configure_bw_alloc()
5653 dev_info(&pf->pdev->dev, in i40e_vsi_configure_bw_alloc()
5655 pf->hw.aq.asq_last_status); in i40e_vsi_configure_bw_alloc()
5674 struct i40e_pf *pf = vsi->back; in i40e_vsi_config_netdev_tc() local
5675 struct i40e_hw *hw = &pf->hw; in i40e_vsi_config_netdev_tc()
5708 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_vsi_config_netdev_tc()
5748 struct i40e_pf *pf; in i40e_update_adq_vsi_queues() local
5754 pf = vsi->back; in i40e_update_adq_vsi_queues()
5755 hw = &pf->hw; in i40e_update_adq_vsi_queues()
5768 vsi->rss_size = min_t(int, pf->alloc_rss_size, in i40e_update_adq_vsi_queues()
5772 dev_info(&pf->pdev->dev, "Failed to reconfig rss for num_queues\n"); in i40e_update_adq_vsi_queues()
5780 dev_info(&pf->pdev->dev, "Update vsi config failed, err %pe aq_err %s\n", in i40e_update_adq_vsi_queues()
5808 struct i40e_pf *pf = vsi->back; in i40e_vsi_config_tc() local
5809 struct i40e_hw *hw = &pf->hw; in i40e_vsi_config_tc()
5829 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5835 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5848 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5856 dev_err(&pf->pdev->dev, in i40e_vsi_config_tc()
5869 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_vsi_config_tc()
5902 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5915 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5957 struct i40e_pf *pf = vsi->back; in i40e_get_link_speed() local
5959 switch (pf->hw.phy.link_info.link_speed) { in i40e_get_link_speed()
6005 struct i40e_pf *pf = vsi->back; in i40e_set_bw_limit() local
6012 dev_err(&pf->pdev->dev, in i40e_set_bw_limit()
6018 dev_warn(&pf->pdev->dev, in i40e_set_bw_limit()
6026 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, seid, credits, in i40e_set_bw_limit()
6029 dev_err(&pf->pdev->dev, in i40e_set_bw_limit()
6032 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_set_bw_limit()
6047 struct i40e_pf *pf = vsi->back; in i40e_remove_queue_channels() local
6091 &pf->cloud_filter_list, cloud_node) { in i40e_remove_queue_channels()
6103 last_aq_status = pf->hw.aq.asq_last_status; in i40e_remove_queue_channels()
6105 dev_info(&pf->pdev->dev, in i40e_remove_queue_channels()
6108 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_remove_queue_channels()
6148 * @pf: ptr to PF device
6157 static int i40e_validate_num_queues(struct i40e_pf *pf, int num_queues, in i40e_validate_num_queues() argument
6168 dev_dbg(&pf->pdev->dev, in i40e_validate_num_queues()
6174 dev_dbg(&pf->pdev->dev, in i40e_validate_num_queues()
6189 dev_dbg(&pf->pdev->dev, in i40e_validate_num_queues()
6209 struct i40e_pf *pf = vsi->back; in i40e_vsi_reconfig_rss() local
6211 struct i40e_hw *hw = &pf->hw; in i40e_vsi_reconfig_rss()
6228 i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, local_rss_size); in i40e_vsi_reconfig_rss()
6240 dev_info(&pf->pdev->dev, in i40e_vsi_reconfig_rss()
6259 * @pf: ptr to PF device
6265 static void i40e_channel_setup_queue_map(struct i40e_pf *pf, in i40e_channel_setup_queue_map() argument
6276 qcount = min_t(int, ch->num_queue_pairs, pf->num_lan_msix); in i40e_channel_setup_queue_map()
6298 * @pf: ptr to PF device
6304 static int i40e_add_channel(struct i40e_pf *pf, u16 uplink_seid, in i40e_add_channel() argument
6307 struct i40e_hw *hw = &pf->hw; in i40e_add_channel()
6313 dev_info(&pf->pdev->dev, in i40e_add_channel()
6326 if (test_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags)) { in i40e_add_channel()
6334 i40e_channel_setup_queue_map(pf, &ctxt, ch); in i40e_add_channel()
6339 dev_info(&pf->pdev->dev, in i40e_add_channel()
6342 i40e_aq_str(&pf->hw, in i40e_add_channel()
6343 pf->hw.aq.asq_last_status)); in i40e_add_channel()
6397 * @pf: ptr to PF device
6404 static int i40e_channel_config_tx_ring(struct i40e_pf *pf, in i40e_channel_config_tx_ring() argument
6449 * @pf: ptr to PF device
6458 static inline int i40e_setup_hw_channel(struct i40e_pf *pf, in i40e_setup_hw_channel() argument
6470 ret = i40e_add_channel(pf, uplink_seid, ch); in i40e_setup_hw_channel()
6472 dev_info(&pf->pdev->dev, in i40e_setup_hw_channel()
6482 ret = i40e_channel_config_tx_ring(pf, vsi, ch); in i40e_setup_hw_channel()
6484 dev_info(&pf->pdev->dev, in i40e_setup_hw_channel()
6492 dev_dbg(&pf->pdev->dev, in i40e_setup_hw_channel()
6493 …"Added channel: vsi_seid %u, vsi_number %u, stat_counter_idx %u, num_queue_pairs %u, pf->next_base… in i40e_setup_hw_channel()
6502 * @pf: ptr to PF device
6509 static bool i40e_setup_channel(struct i40e_pf *pf, struct i40e_vsi *vsi, in i40e_setup_channel() argument
6520 dev_err(&pf->pdev->dev, "unsupported parent vsi type(%d)\n", in i40e_setup_channel()
6526 main_vsi = i40e_pf_get_main_vsi(pf); in i40e_setup_channel()
6530 ret = i40e_setup_hw_channel(pf, vsi, ch, seid, vsi_type); in i40e_setup_channel()
6532 dev_err(&pf->pdev->dev, "failed to setup hw_channel\n"); in i40e_setup_channel()
6541 * @vsi: ptr to VSI which has PF backing
6549 struct i40e_pf *pf = vsi->back; in i40e_validate_and_set_switch_mode() local
6550 struct i40e_hw *hw = &pf->hw; in i40e_validate_and_set_switch_mode()
6553 ret = i40e_get_capabilities(pf, i40e_aqc_opc_list_dev_capabilities); in i40e_validate_and_set_switch_mode()
6566 dev_err(&pf->pdev->dev, in i40e_validate_and_set_switch_mode()
6583 ret = i40e_aq_set_switch_config(hw, pf->last_sw_conf_flags, in i40e_validate_and_set_switch_mode()
6584 pf->last_sw_conf_valid_flags, in i40e_validate_and_set_switch_mode()
6587 dev_err(&pf->pdev->dev, in i40e_validate_and_set_switch_mode()
6607 struct i40e_pf *pf = vsi->back; in i40e_create_queue_channel() local
6615 dev_err(&pf->pdev->dev, "Invalid num_queues requested: %d\n", in i40e_create_queue_channel()
6621 err = i40e_validate_num_queues(pf, ch->num_queue_pairs, vsi, in i40e_create_queue_channel()
6624 dev_info(&pf->pdev->dev, "Failed to validate num_queues (%d)\n", in i40e_create_queue_channel()
6633 if (!test_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags)) { in i40e_create_queue_channel()
6634 set_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_create_queue_channel()
6637 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_create_queue_channel()
6638 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_create_queue_channel()
6640 i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG); in i40e_create_queue_channel()
6651 dev_dbg(&pf->pdev->dev, in i40e_create_queue_channel()
6661 dev_info(&pf->pdev->dev, in i40e_create_queue_channel()
6668 if (!i40e_setup_channel(pf, vsi, ch)) { in i40e_create_queue_channel()
6669 dev_info(&pf->pdev->dev, "Failed to setup channel\n"); in i40e_create_queue_channel()
6673 dev_info(&pf->pdev->dev, in i40e_create_queue_channel()
6685 dev_dbg(&pf->pdev->dev, in i40e_create_queue_channel()
6768 struct i40e_pf *pf = veb->pf; in i40e_veb_config_tc() local
6785 ret = i40e_aq_config_switch_comp_bw_config(&pf->hw, veb->seid, in i40e_veb_config_tc()
6788 dev_info(&pf->pdev->dev, in i40e_veb_config_tc()
6791 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_veb_config_tc()
6798 dev_info(&pf->pdev->dev, in i40e_veb_config_tc()
6801 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_veb_config_tc()
6811 * @pf: PF struct
6813 * Reconfigure VEB/VSIs on a given PF; it is assumed that
6817 static void i40e_dcb_reconfigure(struct i40e_pf *pf) in i40e_dcb_reconfigure() argument
6825 /* Enable the TCs available on PF to all VEBs */ in i40e_dcb_reconfigure()
6826 tc_map = i40e_pf_get_tc_map(pf); in i40e_dcb_reconfigure()
6830 i40e_pf_for_each_veb(pf, v, veb) { in i40e_dcb_reconfigure()
6833 dev_info(&pf->pdev->dev, in i40e_dcb_reconfigure()
6841 i40e_pf_for_each_vsi(pf, v, vsi) { in i40e_dcb_reconfigure()
6846 tc_map = i40e_pf_get_tc_map(pf); in i40e_dcb_reconfigure()
6852 dev_info(&pf->pdev->dev, in i40e_dcb_reconfigure()
6867 * @pf: PF struct
6869 * Resume a port's Tx and issue a PF reset in case of failure to
6872 static int i40e_resume_port_tx(struct i40e_pf *pf) in i40e_resume_port_tx() argument
6874 struct i40e_hw *hw = &pf->hw; in i40e_resume_port_tx()
6879 dev_info(&pf->pdev->dev, in i40e_resume_port_tx()
6882 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_resume_port_tx()
6883 /* Schedule PF reset to recover */ in i40e_resume_port_tx()
6884 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_resume_port_tx()
6885 i40e_service_event_schedule(pf); in i40e_resume_port_tx()
6893 * @pf: PF struct
6895 * Suspend a port's Tx and issue a PF reset in case of failure.
6897 static int i40e_suspend_port_tx(struct i40e_pf *pf) in i40e_suspend_port_tx() argument
6899 struct i40e_hw *hw = &pf->hw; in i40e_suspend_port_tx()
6902 ret = i40e_aq_suspend_port_tx(hw, pf->mac_seid, NULL); in i40e_suspend_port_tx()
6904 dev_info(&pf->pdev->dev, in i40e_suspend_port_tx()
6907 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_suspend_port_tx()
6908 /* Schedule PF reset to recover */ in i40e_suspend_port_tx()
6909 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_suspend_port_tx()
6910 i40e_service_event_schedule(pf); in i40e_suspend_port_tx()
6918 * @pf: PF being configured
6922 * given PF. Uses "Set LLDP MIB" AQC to program the hardware.
6924 static int i40e_hw_set_dcb_config(struct i40e_pf *pf, in i40e_hw_set_dcb_config() argument
6927 struct i40e_dcbx_config *old_cfg = &pf->hw.local_dcbx_config; in i40e_hw_set_dcb_config()
6932 dev_dbg(&pf->pdev->dev, "No Change in DCB Config required.\n"); in i40e_hw_set_dcb_config()
6937 i40e_pf_quiesce_all_vsi(pf); in i40e_hw_set_dcb_config()
6942 ret = i40e_set_dcb_config(&pf->hw); in i40e_hw_set_dcb_config()
6944 dev_info(&pf->pdev->dev, in i40e_hw_set_dcb_config()
6947 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_hw_set_dcb_config()
6952 i40e_dcb_reconfigure(pf); in i40e_hw_set_dcb_config()
6955 if (!test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) { in i40e_hw_set_dcb_config()
6957 ret = i40e_resume_port_tx(pf); in i40e_hw_set_dcb_config()
6961 i40e_pf_unquiesce_all_vsi(pf); in i40e_hw_set_dcb_config()
6969 * @pf: PF being configured
6973 * given PF
6975 int i40e_hw_dcb_config(struct i40e_pf *pf, struct i40e_dcbx_config *new_cfg) in i40e_hw_dcb_config() argument
6983 struct i40e_hw *hw = &pf->hw; in i40e_hw_dcb_config()
6992 dev_dbg(&pf->pdev->dev, "Configuring DCB registers directly\n"); in i40e_hw_dcb_config()
7034 need_reconfig = i40e_dcb_need_reconfig(pf, old_cfg, new_cfg); in i40e_hw_dcb_config()
7042 set_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_hw_dcb_config()
7044 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_hw_dcb_config()
7046 set_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_hw_dcb_config()
7048 i40e_pf_quiesce_all_vsi(pf); in i40e_hw_dcb_config()
7049 ret = i40e_suspend_port_tx(pf); in i40e_hw_dcb_config()
7058 (hw, pf->mac_seid, &ets_data, in i40e_hw_dcb_config()
7061 dev_info(&pf->pdev->dev, in i40e_hw_dcb_config()
7064 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_hw_dcb_config()
7084 struct i40e_vsi *main_vsi = i40e_pf_get_main_vsi(pf); in i40e_hw_dcb_config()
7093 i40e_dcb_hw_rx_pb_config(hw, &pf->pb_cfg, &pb_cfg); in i40e_hw_dcb_config()
7096 pf->pb_cfg = pb_cfg; in i40e_hw_dcb_config()
7099 ret = i40e_aq_dcb_updated(&pf->hw, NULL); in i40e_hw_dcb_config()
7101 dev_info(&pf->pdev->dev, in i40e_hw_dcb_config()
7104 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_hw_dcb_config()
7112 i40e_dcb_reconfigure(pf); in i40e_hw_dcb_config()
7116 ret = i40e_resume_port_tx(pf); in i40e_hw_dcb_config()
7118 clear_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_hw_dcb_config()
7123 /* Wait for the PF's queues to be disabled */ in i40e_hw_dcb_config()
7124 ret = i40e_pf_wait_queues_disabled(pf); in i40e_hw_dcb_config()
7126 /* Schedule PF reset to recover */ in i40e_hw_dcb_config()
7127 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_hw_dcb_config()
7128 i40e_service_event_schedule(pf); in i40e_hw_dcb_config()
7131 i40e_pf_unquiesce_all_vsi(pf); in i40e_hw_dcb_config()
7132 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_hw_dcb_config()
7133 set_bit(__I40E_CLIENT_L2_CHANGE, pf->state); in i40e_hw_dcb_config()
7136 if (test_bit(I40E_HW_CAP_USE_SET_LLDP_MIB, pf->hw.caps)) in i40e_hw_dcb_config()
7137 ret = i40e_hw_set_dcb_config(pf, new_cfg); in i40e_hw_dcb_config()
7146 * @pf: PF being queried
7150 int i40e_dcb_sw_default_config(struct i40e_pf *pf) in i40e_dcb_sw_default_config() argument
7152 struct i40e_dcbx_config *dcb_cfg = &pf->hw.local_dcbx_config; in i40e_dcb_sw_default_config()
7154 struct i40e_hw *hw = &pf->hw; in i40e_dcb_sw_default_config()
7157 if (test_bit(I40E_HW_CAP_USE_SET_LLDP_MIB, pf->hw.caps)) { in i40e_dcb_sw_default_config()
7159 memset(&pf->tmp_cfg, 0, sizeof(struct i40e_dcbx_config)); in i40e_dcb_sw_default_config()
7160 pf->tmp_cfg.etscfg.willing = I40E_IEEE_DEFAULT_ETS_WILLING; in i40e_dcb_sw_default_config()
7161 pf->tmp_cfg.etscfg.maxtcs = 0; in i40e_dcb_sw_default_config()
7162 pf->tmp_cfg.etscfg.tcbwtable[0] = I40E_IEEE_DEFAULT_ETS_TCBW; in i40e_dcb_sw_default_config()
7163 pf->tmp_cfg.etscfg.tsatable[0] = I40E_IEEE_TSA_ETS; in i40e_dcb_sw_default_config()
7164 pf->tmp_cfg.pfc.willing = I40E_IEEE_DEFAULT_PFC_WILLING; in i40e_dcb_sw_default_config()
7165 pf->tmp_cfg.pfc.pfccap = I40E_MAX_TRAFFIC_CLASS; in i40e_dcb_sw_default_config()
7167 pf->tmp_cfg.numapps = I40E_IEEE_DEFAULT_NUM_APPS; in i40e_dcb_sw_default_config()
7168 pf->tmp_cfg.app[0].selector = I40E_APP_SEL_ETHTYPE; in i40e_dcb_sw_default_config()
7169 pf->tmp_cfg.app[0].priority = I40E_IEEE_DEFAULT_APP_PRIO; in i40e_dcb_sw_default_config()
7170 pf->tmp_cfg.app[0].protocolid = I40E_APP_PROTOID_FCOE; in i40e_dcb_sw_default_config()
7172 return i40e_hw_set_dcb_config(pf, &pf->tmp_cfg); in i40e_dcb_sw_default_config()
7182 (hw, pf->mac_seid, &ets_data, in i40e_dcb_sw_default_config()
7185 dev_info(&pf->pdev->dev, in i40e_dcb_sw_default_config()
7188 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_dcb_sw_default_config()
7205 * @pf: PF being configured
7210 static int i40e_init_pf_dcb(struct i40e_pf *pf) in i40e_init_pf_dcb() argument
7212 struct i40e_hw *hw = &pf->hw; in i40e_init_pf_dcb()
7218 if (test_bit(I40E_HW_CAP_NO_DCB_SUPPORT, pf->hw.caps)) { in i40e_init_pf_dcb()
7219 dev_info(&pf->pdev->dev, "DCB is not supported.\n"); in i40e_init_pf_dcb()
7223 if (test_bit(I40E_FLAG_FW_LLDP_DIS, pf->flags)) { in i40e_init_pf_dcb()
7224 dev_info(&pf->pdev->dev, "FW LLDP is disabled, attempting SW DCB\n"); in i40e_init_pf_dcb()
7225 err = i40e_dcb_sw_default_config(pf); in i40e_init_pf_dcb()
7227 dev_info(&pf->pdev->dev, "Could not initialize SW DCB\n"); in i40e_init_pf_dcb()
7230 dev_info(&pf->pdev->dev, "SW DCB initialization succeeded.\n"); in i40e_init_pf_dcb()
7231 pf->dcbx_cap = DCB_CAP_DCBX_HOST | in i40e_init_pf_dcb()
7234 set_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_init_pf_dcb()
7235 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_init_pf_dcb()
7243 dev_info(&pf->pdev->dev, in i40e_init_pf_dcb()
7244 "DCBX offload is not supported or is disabled for this PF.\n"); in i40e_init_pf_dcb()
7247 pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED | in i40e_init_pf_dcb()
7250 set_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_init_pf_dcb()
7255 set_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_init_pf_dcb()
7257 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_init_pf_dcb()
7258 dev_dbg(&pf->pdev->dev, in i40e_init_pf_dcb()
7259 "DCBX offload is supported for this PF.\n"); in i40e_init_pf_dcb()
7261 } else if (pf->hw.aq.asq_last_status == I40E_AQ_RC_EPERM) { in i40e_init_pf_dcb()
7262 dev_info(&pf->pdev->dev, "FW LLDP disabled for this PF.\n"); in i40e_init_pf_dcb()
7263 set_bit(I40E_FLAG_FW_LLDP_DIS, pf->flags); in i40e_init_pf_dcb()
7265 dev_info(&pf->pdev->dev, in i40e_init_pf_dcb()
7268 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_init_pf_dcb()
7304 struct i40e_pf *pf = vsi->back; in i40e_print_link_message() local
7312 new_speed = pf->hw.phy.link_info.link_speed; in i40e_print_link_message()
7328 if (pf->hw.func_caps.npar_enable && in i40e_print_link_message()
7329 (pf->hw.phy.link_info.link_speed == I40E_LINK_SPEED_1GB || in i40e_print_link_message()
7330 pf->hw.phy.link_info.link_speed == I40E_LINK_SPEED_100MB)) in i40e_print_link_message()
7334 switch (pf->hw.phy.link_info.link_speed) { in i40e_print_link_message()
7363 switch (pf->hw.fc.current_mode) { in i40e_print_link_message()
7378 if (pf->hw.phy.link_info.link_speed == I40E_LINK_SPEED_25GB) { in i40e_print_link_message()
7383 if (pf->hw.phy.link_info.an_info & I40E_AQ_AN_COMPLETED) in i40e_print_link_message()
7386 if (pf->hw.phy.link_info.fec_info & in i40e_print_link_message()
7389 else if (pf->hw.phy.link_info.fec_info & in i40e_print_link_message()
7407 } else if (pf->hw.device_id == I40E_DEV_ID_KX_X722) { in i40e_print_link_message()
7412 if (pf->hw.phy.link_info.an_info & I40E_AQ_AN_COMPLETED) in i40e_print_link_message()
7415 if (pf->hw.phy.link_info.fec_info & in i40e_print_link_message()
7419 if (pf->hw.phy.link_info.req_fec_info & in i40e_print_link_message()
7438 struct i40e_pf *pf = vsi->back; in i40e_up_complete() local
7441 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_up_complete()
7455 if ((pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP) && in i40e_up_complete()
7465 pf->fd_add_err = 0; in i40e_up_complete()
7466 pf->fd_atr_cnt = 0; in i40e_up_complete()
7473 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_up_complete()
7474 i40e_service_event_schedule(pf); in i40e_up_complete()
7488 struct i40e_pf *pf = vsi->back; in i40e_vsi_reinit_locked() local
7490 while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) in i40e_vsi_reinit_locked()
7495 clear_bit(__I40E_CONFIG_BUSY, pf->state); in i40e_vsi_reinit_locked()
7500 * @pf: board private structure
7503 static int i40e_force_link_state(struct i40e_pf *pf, bool is_up) in i40e_force_link_state() argument
7508 struct i40e_hw *hw = &pf->hw; in i40e_force_link_state()
7522 dev_err(&pf->pdev->dev, in i40e_force_link_state()
7534 dev_err(&pf->pdev->dev, in i40e_force_link_state()
7545 if (test_bit(I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENA, pf->flags)) in i40e_force_link_state()
7561 if (test_bit(I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENA, pf->flags)) { in i40e_force_link_state()
7579 dev_err(&pf->pdev->dev, in i40e_force_link_state()
7582 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_force_link_state()
7867 struct i40e_pf *pf = vsi->back; in i40e_fwd_ring_up() local
7868 struct i40e_hw *hw = &pf->hw; in i40e_fwd_ring_up()
7920 dev_info(&pf->pdev->dev, in i40e_fwd_ring_up()
7940 struct i40e_pf *pf = vsi->back; in i40e_setup_macvlans() local
7941 struct i40e_hw *hw = &pf->hw; in i40e_setup_macvlans()
7977 dev_info(&pf->pdev->dev, in i40e_setup_macvlans()
7993 dev_info(&pf->pdev->dev, in i40e_setup_macvlans()
8013 if (!i40e_setup_channel(pf, vsi, ch)) { in i40e_setup_macvlans()
8027 dev_info(&pf->pdev->dev, "Failed to setup macvlans\n"); in i40e_setup_macvlans()
8043 struct i40e_pf *pf = vsi->back; in i40e_fwd_add() local
8047 if (test_bit(I40E_FLAG_DCB_ENA, pf->flags)) { in i40e_fwd_add()
8051 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_fwd_add()
8055 if (pf->num_lan_msix < I40E_MIN_MACVLAN_VECTORS) { in i40e_fwd_add()
8067 /* reserve bit 0 for the pf device */ in i40e_fwd_add()
8074 vectors = pf->num_lan_msix; in i40e_fwd_add()
8076 /* allocate 4 Qs per macvlan and 32 Qs to the PF*/ in i40e_fwd_add()
8080 /* allocate 2 Qs per macvlan and 16 Qs to the PF*/ in i40e_fwd_add()
8084 /* allocate 1 Q per macvlan and 16 Qs to the PF*/ in i40e_fwd_add()
8088 /* allocate 1 Q per macvlan and 8 Qs to the PF */ in i40e_fwd_add()
8092 /* allocate 1 Q per macvlan and 1 Q to the PF */ in i40e_fwd_add()
8151 struct i40e_pf *pf = vsi->back; in i40e_del_all_macvlans() local
8152 struct i40e_hw *hw = &pf->hw; in i40e_del_all_macvlans()
8188 struct i40e_pf *pf = vsi->back; in i40e_fwd_del() local
8189 struct i40e_hw *hw = &pf->hw; in i40e_fwd_del()
8209 dev_info(&pf->pdev->dev, in i40e_fwd_del()
8229 struct i40e_pf *pf = vsi->back; in i40e_setup_tc() local
8242 clear_bit(I40E_FLAG_TC_MQPRIO_ENA, pf->flags); in i40e_setup_tc()
8248 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) { in i40e_setup_tc()
8255 clear_bit(I40E_FLAG_TC_MQPRIO_ENA, pf->flags); in i40e_setup_tc()
8258 if (!test_bit(I40E_FLAG_DCB_ENA, pf->flags)) { in i40e_setup_tc()
8265 if (num_tc > i40e_pf_get_num_tc(pf)) { in i40e_setup_tc()
8272 if (test_bit(I40E_FLAG_DCB_ENA, pf->flags)) { in i40e_setup_tc()
8277 if (!test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_setup_tc()
8284 set_bit(I40E_FLAG_TC_MQPRIO_ENA, pf->flags); in i40e_setup_tc()
8285 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_setup_tc()
8304 if (!hw && !i40e_is_tc_mqprio_enabled(pf)) in i40e_setup_tc()
8328 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_setup_tc()
8426 struct i40e_pf *pf = vsi->back; in i40e_add_del_cloud_filter() local
8465 ret = i40e_aq_add_cloud_filters(&pf->hw, filter->seid, in i40e_add_del_cloud_filter()
8468 ret = i40e_aq_rem_cloud_filters(&pf->hw, filter->seid, in i40e_add_del_cloud_filter()
8471 dev_dbg(&pf->pdev->dev, in i40e_add_del_cloud_filter()
8474 pf->hw.aq.asq_last_status); in i40e_add_del_cloud_filter()
8476 dev_info(&pf->pdev->dev, in i40e_add_del_cloud_filter()
8496 struct i40e_pf *pf = vsi->back; in i40e_add_del_cloud_filter_big_buf() local
8554 dev_err(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8567 dev_err(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8573 ret = i40e_aq_add_cloud_filters_bb(&pf->hw, filter->seid, in i40e_add_del_cloud_filter_big_buf()
8576 ret = i40e_aq_rem_cloud_filters_bb(&pf->hw, filter->seid, in i40e_add_del_cloud_filter_big_buf()
8581 dev_dbg(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8583 add ? "add" : "delete", ret, pf->hw.aq.asq_last_status); in i40e_add_del_cloud_filter_big_buf()
8585 dev_info(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8606 struct i40e_pf *pf = vsi->back; in i40e_parse_cls_flower() local
8618 dev_err(&pf->pdev->dev, "Unsupported key used: 0x%llx\n", in i40e_parse_cls_flower()
8658 dev_err(&pf->pdev->dev, "Bad ether dest mask %pM\n", in i40e_parse_cls_flower()
8668 dev_err(&pf->pdev->dev, "Bad ether src mask %pM\n", in i40e_parse_cls_flower()
8686 dev_err(&pf->pdev->dev, "Bad vlan mask 0x%04x\n", in i40e_parse_cls_flower()
8714 dev_err(&pf->pdev->dev, "Bad ip dst mask %pI4b\n", in i40e_parse_cls_flower()
8724 dev_err(&pf->pdev->dev, "Bad ip src mask %pI4b\n", in i40e_parse_cls_flower()
8731 dev_err(&pf->pdev->dev, "Tenant id not allowed for ip filter\n"); in i40e_parse_cls_flower()
8748 dev_err(&pf->pdev->dev, in i40e_parse_cls_flower()
8770 dev_err(&pf->pdev->dev, "Bad src port mask 0x%04x\n", in i40e_parse_cls_flower()
8780 dev_err(&pf->pdev->dev, "Bad dst port mask 0x%04x\n", in i40e_parse_cls_flower()
8794 dev_err(&pf->pdev->dev, in i40e_parse_cls_flower()
8849 struct i40e_pf *pf = vsi->back; in i40e_configure_clsflower() local
8858 dev_err(&pf->pdev->dev, "Unable to add filter because of invalid destination"); in i40e_configure_clsflower()
8862 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) || in i40e_configure_clsflower()
8863 test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) in i40e_configure_clsflower()
8866 if (pf->fdir_pf_active_filters || in i40e_configure_clsflower()
8867 (!hlist_empty(&pf->fdir_filter_list))) { in i40e_configure_clsflower()
8901 dev_err(&pf->pdev->dev, "Failed to add cloud filter, err %d\n", in i40e_configure_clsflower()
8909 hlist_add_head(&filter->cloud_node, &pf->cloud_filter_list); in i40e_configure_clsflower()
8911 pf->num_cloud_filters++; in i40e_configure_clsflower()
8948 struct i40e_pf *pf = vsi->back; in i40e_delete_clsflower() local
8965 dev_err(&pf->pdev->dev, in i40e_delete_clsflower()
8968 return i40e_aq_rc_to_posix(err, pf->hw.aq.asq_last_status); in i40e_delete_clsflower()
8971 pf->num_cloud_filters--; in i40e_delete_clsflower()
8972 if (!pf->num_cloud_filters) in i40e_delete_clsflower()
8973 if (test_bit(I40E_FLAG_FD_SB_TO_CLOUD_FILTER, pf->flags) && in i40e_delete_clsflower()
8974 !test_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags)) { in i40e_delete_clsflower()
8975 set_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_delete_clsflower()
8976 clear_bit(I40E_FLAG_FD_SB_TO_CLOUD_FILTER, pf->flags); in i40e_delete_clsflower()
8977 clear_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_delete_clsflower()
9057 struct i40e_pf *pf = vsi->back; in i40e_open() local
9061 if (test_bit(__I40E_TESTING, pf->state) || in i40e_open()
9062 test_bit(__I40E_BAD_EEPROM, pf->state)) in i40e_open()
9067 if (i40e_force_link_state(pf, true)) in i40e_open()
9075 wr32(&pf->hw, I40E_GLLAN_TSOMSK_F, be32_to_cpu(TCP_FLAG_PSH | in i40e_open()
9077 wr32(&pf->hw, I40E_GLLAN_TSOMSK_M, be32_to_cpu(TCP_FLAG_PSH | in i40e_open()
9080 wr32(&pf->hw, I40E_GLLAN_TSOMSK_L, be32_to_cpu(TCP_FLAG_CWR) >> 16); in i40e_open()
9119 struct i40e_pf *pf = vsi->back; in i40e_vsi_open() local
9137 dev_driver_string(&pf->pdev->dev), vsi->netdev->name); in i40e_vsi_open()
9149 dev_driver_string(&pf->pdev->dev), in i40e_vsi_open()
9150 dev_name(&pf->pdev->dev)); in i40e_vsi_open()
9175 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_vsi_open()
9182 * @pf: Pointer to PF
9187 static void i40e_fdir_filter_exit(struct i40e_pf *pf) in i40e_fdir_filter_exit() argument
9194 &pf->fdir_filter_list, fdir_node) { in i40e_fdir_filter_exit()
9199 list_for_each_entry_safe(pit_entry, tmp, &pf->l3_flex_pit_list, list) { in i40e_fdir_filter_exit()
9203 INIT_LIST_HEAD(&pf->l3_flex_pit_list); in i40e_fdir_filter_exit()
9205 list_for_each_entry_safe(pit_entry, tmp, &pf->l4_flex_pit_list, list) { in i40e_fdir_filter_exit()
9209 INIT_LIST_HEAD(&pf->l4_flex_pit_list); in i40e_fdir_filter_exit()
9211 pf->fdir_pf_active_filters = 0; in i40e_fdir_filter_exit()
9212 i40e_reset_fdir_filter_cnt(pf); in i40e_fdir_filter_exit()
9215 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_TCP, in i40e_fdir_filter_exit()
9220 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_TCP, in i40e_fdir_filter_exit()
9225 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_UDP, in i40e_fdir_filter_exit()
9230 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_UDP, in i40e_fdir_filter_exit()
9235 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_SCTP, in i40e_fdir_filter_exit()
9240 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_SCTP, in i40e_fdir_filter_exit()
9245 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_OTHER, in i40e_fdir_filter_exit()
9248 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV4, in i40e_fdir_filter_exit()
9252 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_OTHER, in i40e_fdir_filter_exit()
9255 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV6, in i40e_fdir_filter_exit()
9261 * @pf: Pointer to PF
9266 static void i40e_cloud_filter_exit(struct i40e_pf *pf) in i40e_cloud_filter_exit() argument
9272 &pf->cloud_filter_list, cloud_node) { in i40e_cloud_filter_exit()
9276 pf->num_cloud_filters = 0; in i40e_cloud_filter_exit()
9278 if (test_bit(I40E_FLAG_FD_SB_TO_CLOUD_FILTER, pf->flags) && in i40e_cloud_filter_exit()
9279 !test_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags)) { in i40e_cloud_filter_exit()
9280 set_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_cloud_filter_exit()
9281 clear_bit(I40E_FLAG_FD_SB_TO_CLOUD_FILTER, pf->flags); in i40e_cloud_filter_exit()
9282 clear_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_cloud_filter_exit()
9307 * i40e_do_reset - Start a PF or Core Reset sequence
9308 * @pf: board private structure
9313 * The essential difference in resets is that the PF Reset
9317 void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags, bool lock_acquired) in i40e_do_reset() argument
9334 dev_dbg(&pf->pdev->dev, "GlobalR requested\n"); in i40e_do_reset()
9335 val = rd32(&pf->hw, I40E_GLGEN_RTRIG); in i40e_do_reset()
9337 wr32(&pf->hw, I40E_GLGEN_RTRIG, val); in i40e_do_reset()
9345 dev_dbg(&pf->pdev->dev, "CoreR requested\n"); in i40e_do_reset()
9346 val = rd32(&pf->hw, I40E_GLGEN_RTRIG); in i40e_do_reset()
9348 wr32(&pf->hw, I40E_GLGEN_RTRIG, val); in i40e_do_reset()
9349 i40e_flush(&pf->hw); in i40e_do_reset()
9353 /* Request a PF Reset in i40e_do_reset()
9355 * Resets only the PF-specific registers in i40e_do_reset()
9361 dev_dbg(&pf->pdev->dev, "PFR requested\n"); in i40e_do_reset()
9362 i40e_handle_reset_warning(pf, lock_acquired); in i40e_do_reset()
9365 /* Request a PF Reset in i40e_do_reset()
9367 * Resets PF and reinitializes PFs VSI. in i40e_do_reset()
9369 i40e_prep_for_reset(pf); in i40e_do_reset()
9370 i40e_reset_and_rebuild(pf, true, lock_acquired); in i40e_do_reset()
9371 dev_info(&pf->pdev->dev, in i40e_do_reset()
9372 test_bit(I40E_FLAG_FW_LLDP_DIS, pf->flags) ? in i40e_do_reset()
9378 dev_info(&pf->pdev->dev, "VSI reinit requested\n"); in i40e_do_reset()
9380 i40e_pf_for_each_vsi(pf, i, vsi) { in i40e_do_reset()
9387 dev_info(&pf->pdev->dev, "VSI down requested\n"); in i40e_do_reset()
9389 i40e_pf_for_each_vsi(pf, i, vsi) { in i40e_do_reset()
9397 dev_info(&pf->pdev->dev, in i40e_do_reset()
9405 * @pf: board private structure
9409 bool i40e_dcb_need_reconfig(struct i40e_pf *pf, in i40e_dcb_need_reconfig() argument
9424 dev_dbg(&pf->pdev->dev, "ETS UP2TC changed.\n"); in i40e_dcb_need_reconfig()
9430 dev_dbg(&pf->pdev->dev, "ETS TC BW Table changed.\n"); in i40e_dcb_need_reconfig()
9435 dev_dbg(&pf->pdev->dev, "ETS TSA Table changed.\n"); in i40e_dcb_need_reconfig()
9443 dev_dbg(&pf->pdev->dev, "PFC config change detected.\n"); in i40e_dcb_need_reconfig()
9451 dev_dbg(&pf->pdev->dev, "APP Table change detected.\n"); in i40e_dcb_need_reconfig()
9454 dev_dbg(&pf->pdev->dev, "dcb need_reconfig=%d\n", need_reconfig); in i40e_dcb_need_reconfig()
9460 * @pf: board private structure
9463 static int i40e_handle_lldp_event(struct i40e_pf *pf, in i40e_handle_lldp_event() argument
9468 struct i40e_hw *hw = &pf->hw; in i40e_handle_lldp_event()
9478 !test_bit(I40E_FLAG_DCB_CAPABLE, pf->flags)) in i40e_handle_lldp_event()
9480 set_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_handle_lldp_event()
9483 if (!test_bit(I40E_FLAG_DCB_CAPABLE, pf->flags)) in i40e_handle_lldp_event()
9489 dev_dbg(&pf->pdev->dev, "LLDP event mib bridge type 0x%x\n", type); in i40e_handle_lldp_event()
9495 dev_dbg(&pf->pdev->dev, in i40e_handle_lldp_event()
9511 ret = i40e_get_dcb_config(&pf->hw); in i40e_handle_lldp_event()
9517 dev_warn(&pf->pdev->dev, in i40e_handle_lldp_event()
9519 clear_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_handle_lldp_event()
9521 dev_info(&pf->pdev->dev, in i40e_handle_lldp_event()
9524 i40e_aq_str(&pf->hw, in i40e_handle_lldp_event()
9525 pf->hw.aq.asq_last_status)); in i40e_handle_lldp_event()
9533 dev_dbg(&pf->pdev->dev, "No change detected in DCBX configuration.\n"); in i40e_handle_lldp_event()
9537 need_reconfig = i40e_dcb_need_reconfig(pf, &tmp_dcbx_cfg, in i40e_handle_lldp_event()
9540 i40e_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &hw->local_dcbx_config); in i40e_handle_lldp_event()
9547 set_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_handle_lldp_event()
9549 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_handle_lldp_event()
9551 set_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_handle_lldp_event()
9553 i40e_pf_quiesce_all_vsi(pf); in i40e_handle_lldp_event()
9556 i40e_dcb_reconfigure(pf); in i40e_handle_lldp_event()
9558 ret = i40e_resume_port_tx(pf); in i40e_handle_lldp_event()
9560 clear_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_handle_lldp_event()
9565 /* Wait for the PF's queues to be disabled */ in i40e_handle_lldp_event()
9566 ret = i40e_pf_wait_queues_disabled(pf); in i40e_handle_lldp_event()
9568 /* Schedule PF reset to recover */ in i40e_handle_lldp_event()
9569 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_handle_lldp_event()
9570 i40e_service_event_schedule(pf); in i40e_handle_lldp_event()
9572 i40e_pf_unquiesce_all_vsi(pf); in i40e_handle_lldp_event()
9573 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_handle_lldp_event()
9574 set_bit(__I40E_CLIENT_L2_CHANGE, pf->state); in i40e_handle_lldp_event()
9584 * @pf: board private structure
9588 void i40e_do_reset_safe(struct i40e_pf *pf, u32 reset_flags) in i40e_do_reset_safe() argument
9591 i40e_do_reset(pf, reset_flags, true); in i40e_do_reset_safe()
9597 * @pf: board private structure
9600 * Handler for LAN Queue Overflow Event generated by the firmware for PF
9603 static void i40e_handle_lan_overflow_event(struct i40e_pf *pf, in i40e_handle_lan_overflow_event() argument
9610 struct i40e_hw *hw = &pf->hw; in i40e_handle_lan_overflow_event()
9614 dev_dbg(&pf->pdev->dev, "overflow Rx Queue Number = %d QTX_CTL=0x%08x\n", in i40e_handle_lan_overflow_event()
9624 vf = &pf->vf[vf_id]; in i40e_handle_lan_overflow_event()
9633 * @pf: board private structure
9635 u32 i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf) in i40e_get_cur_guaranteed_fd_count() argument
9639 val = rd32(&pf->hw, I40E_PFQF_FDSTAT); in i40e_get_cur_guaranteed_fd_count()
9645 * i40e_get_current_fd_count - Get total FD filters programmed for this PF
9646 * @pf: board private structure
9648 u32 i40e_get_current_fd_count(struct i40e_pf *pf) in i40e_get_current_fd_count() argument
9652 val = rd32(&pf->hw, I40E_PFQF_FDSTAT); in i40e_get_current_fd_count()
9660 * @pf: board private structure
9662 u32 i40e_get_global_fd_count(struct i40e_pf *pf) in i40e_get_global_fd_count() argument
9666 val = rd32(&pf->hw, I40E_GLQF_FDCNT_0); in i40e_get_global_fd_count()
9674 * @pf: board private structure
9676 static void i40e_reenable_fdir_sb(struct i40e_pf *pf) in i40e_reenable_fdir_sb() argument
9678 if (test_and_clear_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state)) in i40e_reenable_fdir_sb()
9679 if (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags) && in i40e_reenable_fdir_sb()
9680 (I40E_DEBUG_FD & pf->hw.debug_mask)) in i40e_reenable_fdir_sb()
9681 …dev_info(&pf->pdev->dev, "FD Sideband/ntuple is being enabled since we have space in the table now… in i40e_reenable_fdir_sb()
9686 * @pf: board private structure
9688 static void i40e_reenable_fdir_atr(struct i40e_pf *pf) in i40e_reenable_fdir_atr() argument
9690 if (test_and_clear_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state)) { in i40e_reenable_fdir_atr()
9696 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_TCP, in i40e_reenable_fdir_atr()
9700 if (test_bit(I40E_FLAG_FD_ATR_ENA, pf->flags) && in i40e_reenable_fdir_atr()
9701 (I40E_DEBUG_FD & pf->hw.debug_mask)) in i40e_reenable_fdir_atr()
9702 …dev_info(&pf->pdev->dev, "ATR is being enabled since we have space in the table and there are no c… in i40e_reenable_fdir_atr()
9708 * @pf: board private structure
9711 static void i40e_delete_invalid_filter(struct i40e_pf *pf, in i40e_delete_invalid_filter() argument
9715 pf->fdir_pf_active_filters--; in i40e_delete_invalid_filter()
9716 pf->fd_inv = 0; in i40e_delete_invalid_filter()
9720 pf->fd_tcp4_filter_cnt--; in i40e_delete_invalid_filter()
9723 pf->fd_udp4_filter_cnt--; in i40e_delete_invalid_filter()
9726 pf->fd_sctp4_filter_cnt--; in i40e_delete_invalid_filter()
9729 pf->fd_tcp6_filter_cnt--; in i40e_delete_invalid_filter()
9732 pf->fd_udp6_filter_cnt--; in i40e_delete_invalid_filter()
9735 pf->fd_udp6_filter_cnt--; in i40e_delete_invalid_filter()
9740 pf->fd_tcp4_filter_cnt--; in i40e_delete_invalid_filter()
9743 pf->fd_udp4_filter_cnt--; in i40e_delete_invalid_filter()
9746 pf->fd_sctp4_filter_cnt--; in i40e_delete_invalid_filter()
9749 pf->fd_ip4_filter_cnt--; in i40e_delete_invalid_filter()
9756 pf->fd_tcp6_filter_cnt--; in i40e_delete_invalid_filter()
9759 pf->fd_udp6_filter_cnt--; in i40e_delete_invalid_filter()
9762 pf->fd_sctp6_filter_cnt--; in i40e_delete_invalid_filter()
9765 pf->fd_ip6_filter_cnt--; in i40e_delete_invalid_filter()
9778 * @pf: board private structure
9780 void i40e_fdir_check_and_reenable(struct i40e_pf *pf) in i40e_fdir_check_and_reenable() argument
9786 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state)) in i40e_fdir_check_and_reenable()
9790 fcnt_prog = i40e_get_global_fd_count(pf); in i40e_fdir_check_and_reenable()
9791 fcnt_avail = pf->fdir_pf_filter_count; in i40e_fdir_check_and_reenable()
9793 (pf->fd_add_err == 0) || in i40e_fdir_check_and_reenable()
9794 (i40e_get_current_atr_cnt(pf) < pf->fd_atr_cnt)) in i40e_fdir_check_and_reenable()
9795 i40e_reenable_fdir_sb(pf); in i40e_fdir_check_and_reenable()
9802 pf->fd_tcp4_filter_cnt == 0 && pf->fd_tcp6_filter_cnt == 0) in i40e_fdir_check_and_reenable()
9803 i40e_reenable_fdir_atr(pf); in i40e_fdir_check_and_reenable()
9806 if (pf->fd_inv > 0) { in i40e_fdir_check_and_reenable()
9808 &pf->fdir_filter_list, fdir_node) in i40e_fdir_check_and_reenable()
9809 if (filter->fd_id == pf->fd_inv) in i40e_fdir_check_and_reenable()
9810 i40e_delete_invalid_filter(pf, filter); in i40e_fdir_check_and_reenable()
9818 * @pf: board private structure
9820 static void i40e_fdir_flush_and_replay(struct i40e_pf *pf) in i40e_fdir_flush_and_replay() argument
9828 if (!time_after(jiffies, pf->fd_flush_timestamp + in i40e_fdir_flush_and_replay()
9835 min_flush_time = pf->fd_flush_timestamp + in i40e_fdir_flush_and_replay()
9837 fd_room = pf->fdir_pf_filter_count - pf->fdir_pf_active_filters; in i40e_fdir_flush_and_replay()
9841 if (I40E_DEBUG_FD & pf->hw.debug_mask) in i40e_fdir_flush_and_replay()
9842 dev_info(&pf->pdev->dev, "ATR disabled, not enough FD filter space.\n"); in i40e_fdir_flush_and_replay()
9846 pf->fd_flush_timestamp = jiffies; in i40e_fdir_flush_and_replay()
9847 set_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state); in i40e_fdir_flush_and_replay()
9849 wr32(&pf->hw, I40E_PFQF_CTL_1, in i40e_fdir_flush_and_replay()
9851 i40e_flush(&pf->hw); in i40e_fdir_flush_and_replay()
9852 pf->fd_flush_cnt++; in i40e_fdir_flush_and_replay()
9853 pf->fd_add_err = 0; in i40e_fdir_flush_and_replay()
9857 reg = rd32(&pf->hw, I40E_PFQF_CTL_1); in i40e_fdir_flush_and_replay()
9862 dev_warn(&pf->pdev->dev, "FD table did not flush, needs more time\n"); in i40e_fdir_flush_and_replay()
9865 i40e_fdir_filter_restore(i40e_pf_get_main_vsi(pf)); in i40e_fdir_flush_and_replay()
9866 if (!disable_atr && !pf->fd_tcp4_filter_cnt) in i40e_fdir_flush_and_replay()
9867 clear_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state); in i40e_fdir_flush_and_replay()
9868 clear_bit(__I40E_FD_FLUSH_REQUESTED, pf->state); in i40e_fdir_flush_and_replay()
9869 if (I40E_DEBUG_FD & pf->hw.debug_mask) in i40e_fdir_flush_and_replay()
9870 dev_info(&pf->pdev->dev, "FD Filter table flushed and FD-SB replayed.\n"); in i40e_fdir_flush_and_replay()
9876 * @pf: board private structure
9878 u32 i40e_get_current_atr_cnt(struct i40e_pf *pf) in i40e_get_current_atr_cnt() argument
9880 return i40e_get_current_fd_count(pf) - pf->fdir_pf_active_filters; in i40e_get_current_atr_cnt()
9885 * @pf: board private structure
9887 static void i40e_fdir_reinit_subtask(struct i40e_pf *pf) in i40e_fdir_reinit_subtask() argument
9891 if (test_bit(__I40E_DOWN, pf->state)) in i40e_fdir_reinit_subtask()
9894 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state)) in i40e_fdir_reinit_subtask()
9895 i40e_fdir_flush_and_replay(pf); in i40e_fdir_reinit_subtask()
9897 i40e_fdir_check_and_reenable(pf); in i40e_fdir_reinit_subtask()
9944 struct i40e_pf *pf; in i40e_veb_link_event() local
9947 if (!veb || !veb->pf) in i40e_veb_link_event()
9949 pf = veb->pf; in i40e_veb_link_event()
9952 i40e_pf_for_each_vsi(pf, i, vsi) in i40e_veb_link_event()
9959 * @pf: board private structure
9961 static void i40e_link_event(struct i40e_pf *pf) in i40e_link_event() argument
9963 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_link_event()
9964 struct i40e_veb *veb = i40e_pf_get_main_veb(pf); in i40e_link_event()
9973 pf->hw.phy.get_link_info = true; in i40e_link_event()
9974 old_link = (pf->hw.phy.link_info_old.link_info & I40E_AQ_LINK_UP); in i40e_link_event()
9975 status = i40e_get_link_status(&pf->hw, &new_link); in i40e_link_event()
9979 clear_bit(__I40E_TEMP_LINK_POLLING, pf->state); in i40e_link_event()
9984 set_bit(__I40E_TEMP_LINK_POLLING, pf->state); in i40e_link_event()
9985 dev_dbg(&pf->pdev->dev, "couldn't get link state, status: %d\n", in i40e_link_event()
9990 old_link_speed = pf->hw.phy.link_info_old.link_speed; in i40e_link_event()
9991 new_link_speed = pf->hw.phy.link_info.link_speed; in i40e_link_event()
10009 if (pf->vf) in i40e_link_event()
10010 i40e_vc_notify_link_state(pf); in i40e_link_event()
10012 if (test_bit(I40E_FLAG_PTP_ENA, pf->flags)) in i40e_link_event()
10013 i40e_ptp_set_increment(pf); in i40e_link_event()
10018 if (pf->dcbx_cap & DCB_CAP_DCBX_LLD_MANAGED) in i40e_link_event()
10025 dev_dbg(&pf->pdev->dev, "Reconfig DCB to single TC as result of Link Down\n"); in i40e_link_event()
10026 memset(&pf->tmp_cfg, 0, sizeof(pf->tmp_cfg)); in i40e_link_event()
10027 err = i40e_dcb_sw_default_config(pf); in i40e_link_event()
10029 clear_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_link_event()
10030 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_link_event()
10032 pf->dcbx_cap = DCB_CAP_DCBX_HOST | in i40e_link_event()
10034 set_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_link_event()
10035 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_link_event()
10043 * @pf: board private structure
10045 static void i40e_watchdog_subtask(struct i40e_pf *pf) in i40e_watchdog_subtask() argument
10052 if (test_bit(__I40E_DOWN, pf->state) || in i40e_watchdog_subtask()
10053 test_bit(__I40E_CONFIG_BUSY, pf->state)) in i40e_watchdog_subtask()
10057 if (time_before(jiffies, (pf->service_timer_previous + in i40e_watchdog_subtask()
10058 pf->service_timer_period))) in i40e_watchdog_subtask()
10060 pf->service_timer_previous = jiffies; in i40e_watchdog_subtask()
10062 if (test_bit(I40E_FLAG_LINK_POLLING_ENA, pf->flags) || in i40e_watchdog_subtask()
10063 test_bit(__I40E_TEMP_LINK_POLLING, pf->state)) in i40e_watchdog_subtask()
10064 i40e_link_event(pf); in i40e_watchdog_subtask()
10069 i40e_pf_for_each_vsi(pf, i, vsi) in i40e_watchdog_subtask()
10073 if (test_bit(I40E_FLAG_VEB_STATS_ENA, pf->flags)) { in i40e_watchdog_subtask()
10075 i40e_pf_for_each_veb(pf, i, veb) in i40e_watchdog_subtask()
10079 i40e_ptp_rx_hang(pf); in i40e_watchdog_subtask()
10080 i40e_ptp_tx_hang(pf); in i40e_watchdog_subtask()
10085 * @pf: board private structure
10087 static void i40e_reset_subtask(struct i40e_pf *pf) in i40e_reset_subtask() argument
10091 if (test_bit(__I40E_REINIT_REQUESTED, pf->state)) { in i40e_reset_subtask()
10093 clear_bit(__I40E_REINIT_REQUESTED, pf->state); in i40e_reset_subtask()
10095 if (test_bit(__I40E_PF_RESET_REQUESTED, pf->state)) { in i40e_reset_subtask()
10097 clear_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_reset_subtask()
10099 if (test_bit(__I40E_CORE_RESET_REQUESTED, pf->state)) { in i40e_reset_subtask()
10101 clear_bit(__I40E_CORE_RESET_REQUESTED, pf->state); in i40e_reset_subtask()
10103 if (test_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state)) { in i40e_reset_subtask()
10105 clear_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state); in i40e_reset_subtask()
10107 if (test_bit(__I40E_DOWN_REQUESTED, pf->state)) { in i40e_reset_subtask()
10109 clear_bit(__I40E_DOWN_REQUESTED, pf->state); in i40e_reset_subtask()
10115 if (test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) { in i40e_reset_subtask()
10116 i40e_prep_for_reset(pf); in i40e_reset_subtask()
10117 i40e_reset(pf); in i40e_reset_subtask()
10118 i40e_rebuild(pf, false, false); in i40e_reset_subtask()
10123 !test_bit(__I40E_DOWN, pf->state) && in i40e_reset_subtask()
10124 !test_bit(__I40E_CONFIG_BUSY, pf->state)) { in i40e_reset_subtask()
10125 i40e_do_reset(pf, reset_flags, false); in i40e_reset_subtask()
10131 * @pf: board private structure
10134 static void i40e_handle_link_event(struct i40e_pf *pf, in i40e_handle_link_event() argument
10146 i40e_link_event(pf); in i40e_handle_link_event()
10150 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
10152 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
10161 (!test_bit(I40E_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags))) { in i40e_handle_link_event()
10162 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
10164 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
10172 * @pf: board private structure
10174 static void i40e_clean_adminq_subtask(struct i40e_pf *pf) in i40e_clean_adminq_subtask() argument
10177 struct i40e_hw *hw = &pf->hw; in i40e_clean_adminq_subtask()
10184 /* Do not run clean AQ when PF reset fails */ in i40e_clean_adminq_subtask()
10185 if (test_bit(__I40E_RESET_FAILED, pf->state)) in i40e_clean_adminq_subtask()
10189 val = rd32(&pf->hw, I40E_PF_ARQLEN); in i40e_clean_adminq_subtask()
10193 dev_info(&pf->pdev->dev, "ARQ VF Error detected\n"); in i40e_clean_adminq_subtask()
10198 dev_info(&pf->pdev->dev, "ARQ Overflow Error detected\n"); in i40e_clean_adminq_subtask()
10200 pf->arq_overflows++; in i40e_clean_adminq_subtask()
10204 dev_info(&pf->pdev->dev, "ARQ Critical Error detected\n"); in i40e_clean_adminq_subtask()
10208 wr32(&pf->hw, I40E_PF_ARQLEN, val); in i40e_clean_adminq_subtask()
10210 val = rd32(&pf->hw, I40E_PF_ATQLEN); in i40e_clean_adminq_subtask()
10213 if (pf->hw.debug_mask & I40E_DEBUG_AQ) in i40e_clean_adminq_subtask()
10214 dev_info(&pf->pdev->dev, "ASQ VF Error detected\n"); in i40e_clean_adminq_subtask()
10218 if (pf->hw.debug_mask & I40E_DEBUG_AQ) in i40e_clean_adminq_subtask()
10219 dev_info(&pf->pdev->dev, "ASQ Overflow Error detected\n"); in i40e_clean_adminq_subtask()
10223 if (pf->hw.debug_mask & I40E_DEBUG_AQ) in i40e_clean_adminq_subtask()
10224 dev_info(&pf->pdev->dev, "ASQ Critical Error detected\n"); in i40e_clean_adminq_subtask()
10228 wr32(&pf->hw, I40E_PF_ATQLEN, val); in i40e_clean_adminq_subtask()
10240 dev_info(&pf->pdev->dev, "ARQ event error %d\n", ret); in i40e_clean_adminq_subtask()
10249 i40e_handle_link_event(pf, &event); in i40e_clean_adminq_subtask()
10253 ret = i40e_vc_process_vf_msg(pf, in i40e_clean_adminq_subtask()
10261 dev_dbg(&pf->pdev->dev, "ARQ: Update LLDP MIB event received\n"); in i40e_clean_adminq_subtask()
10264 i40e_handle_lldp_event(pf, &event); in i40e_clean_adminq_subtask()
10269 dev_dbg(&pf->pdev->dev, "ARQ LAN queue overflow event received\n"); in i40e_clean_adminq_subtask()
10270 i40e_handle_lan_overflow_event(pf, &event); in i40e_clean_adminq_subtask()
10273 dev_info(&pf->pdev->dev, "ARQ: Msg from other pf\n"); in i40e_clean_adminq_subtask()
10278 i40e_debug(&pf->hw, I40E_DEBUG_NVM, in i40e_clean_adminq_subtask()
10283 dev_info(&pf->pdev->dev, in i40e_clean_adminq_subtask()
10291 clear_bit(__I40E_ADMINQ_EVENT_PENDING, pf->state); in i40e_clean_adminq_subtask()
10304 * @pf: board private structure
10306 static void i40e_verify_eeprom(struct i40e_pf *pf) in i40e_verify_eeprom() argument
10310 err = i40e_diag_eeprom_test(&pf->hw); in i40e_verify_eeprom()
10313 err = i40e_diag_eeprom_test(&pf->hw); in i40e_verify_eeprom()
10315 dev_info(&pf->pdev->dev, "eeprom check failed (%d), Tx/Rx traffic disabled\n", in i40e_verify_eeprom()
10317 set_bit(__I40E_BAD_EEPROM, pf->state); in i40e_verify_eeprom()
10321 if (!err && test_bit(__I40E_BAD_EEPROM, pf->state)) { in i40e_verify_eeprom()
10322 dev_info(&pf->pdev->dev, "eeprom check passed, Tx/Rx traffic enabled\n"); in i40e_verify_eeprom()
10323 clear_bit(__I40E_BAD_EEPROM, pf->state); in i40e_verify_eeprom()
10329 * @pf: pointer to the PF structure
10333 static void i40e_enable_pf_switch_lb(struct i40e_pf *pf) in i40e_enable_pf_switch_lb() argument
10335 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_enable_pf_switch_lb()
10339 ctxt.seid = pf->main_vsi_seid; in i40e_enable_pf_switch_lb()
10340 ctxt.pf_num = pf->hw.pf_id; in i40e_enable_pf_switch_lb()
10342 ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); in i40e_enable_pf_switch_lb()
10344 dev_info(&pf->pdev->dev, in i40e_enable_pf_switch_lb()
10345 "couldn't get PF vsi config, err %pe aq_err %s\n", in i40e_enable_pf_switch_lb()
10347 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_enable_pf_switch_lb()
10356 dev_info(&pf->pdev->dev, in i40e_enable_pf_switch_lb()
10359 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_enable_pf_switch_lb()
10365 * @pf: pointer to the PF structure
10369 static void i40e_disable_pf_switch_lb(struct i40e_pf *pf) in i40e_disable_pf_switch_lb() argument
10371 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_disable_pf_switch_lb()
10375 ctxt.seid = pf->main_vsi_seid; in i40e_disable_pf_switch_lb()
10376 ctxt.pf_num = pf->hw.pf_id; in i40e_disable_pf_switch_lb()
10378 ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); in i40e_disable_pf_switch_lb()
10380 dev_info(&pf->pdev->dev, in i40e_disable_pf_switch_lb()
10381 "couldn't get PF vsi config, err %pe aq_err %s\n", in i40e_disable_pf_switch_lb()
10383 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_disable_pf_switch_lb()
10392 dev_info(&pf->pdev->dev, in i40e_disable_pf_switch_lb()
10395 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_disable_pf_switch_lb()
10409 struct i40e_pf *pf = veb->pf; in i40e_config_bridge_mode() local
10411 if (pf->hw.debug_mask & I40E_DEBUG_LAN) in i40e_config_bridge_mode()
10412 dev_info(&pf->pdev->dev, "enabling bridge mode: %s\n", in i40e_config_bridge_mode()
10415 i40e_disable_pf_switch_lb(pf); in i40e_config_bridge_mode()
10417 i40e_enable_pf_switch_lb(pf); in i40e_config_bridge_mode()
10431 struct i40e_pf *pf = veb->pf; in i40e_reconstitute_veb() local
10439 if (WARN_ON(veb->uplink_seid && veb->uplink_seid != pf->mac_seid)) { in i40e_reconstitute_veb()
10440 dev_err(&pf->pdev->dev, in i40e_reconstitute_veb()
10445 if (veb->uplink_seid == pf->mac_seid) { in i40e_reconstitute_veb()
10447 ctl_vsi = i40e_pf_get_main_vsi(pf); in i40e_reconstitute_veb()
10451 dev_err(&pf->pdev->dev, in i40e_reconstitute_veb()
10459 dev_err(&pf->pdev->dev, in i40e_reconstitute_veb()
10474 if (test_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags)) in i40e_reconstitute_veb()
10482 i40e_pf_for_each_vsi(pf, v, vsi) { in i40e_reconstitute_veb()
10490 dev_info(&pf->pdev->dev, in i40e_reconstitute_veb()
10504 * @pf: the PF struct
10507 static int i40e_get_capabilities(struct i40e_pf *pf, in i40e_get_capabilities() argument
10522 err = i40e_aq_discover_capabilities(&pf->hw, cap_buf, buf_len, in i40e_get_capabilities()
10528 if (pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) { in i40e_get_capabilities()
10531 } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK || err) { in i40e_get_capabilities()
10532 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10535 i40e_aq_str(&pf->hw, in i40e_get_capabilities()
10536 pf->hw.aq.asq_last_status)); in i40e_get_capabilities()
10541 if (pf->hw.debug_mask & I40E_DEBUG_USER) { in i40e_get_capabilities()
10543 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10544 "pf=%d, num_vfs=%d, msix_pf=%d, msix_vf=%d, fd_g=%d, fd_b=%d, pf_max_q=%d num_vsi=%d\n", in i40e_get_capabilities()
10545 pf->hw.pf_id, pf->hw.func_caps.num_vfs, in i40e_get_capabilities()
10546 pf->hw.func_caps.num_msix_vectors, in i40e_get_capabilities()
10547 pf->hw.func_caps.num_msix_vectors_vf, in i40e_get_capabilities()
10548 pf->hw.func_caps.fd_filters_guaranteed, in i40e_get_capabilities()
10549 pf->hw.func_caps.fd_filters_best_effort, in i40e_get_capabilities()
10550 pf->hw.func_caps.num_tx_qp, in i40e_get_capabilities()
10551 pf->hw.func_caps.num_vsis); in i40e_get_capabilities()
10553 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10555 pf->hw.dev_caps.switch_mode, in i40e_get_capabilities()
10556 pf->hw.dev_caps.valid_functions); in i40e_get_capabilities()
10557 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10559 pf->hw.dev_caps.sr_iov_1_1, in i40e_get_capabilities()
10560 pf->hw.dev_caps.num_vfs); in i40e_get_capabilities()
10561 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10563 pf->hw.dev_caps.num_vsis, in i40e_get_capabilities()
10564 pf->hw.dev_caps.num_rx_qp, in i40e_get_capabilities()
10565 pf->hw.dev_caps.num_tx_qp); in i40e_get_capabilities()
10569 #define DEF_NUM_VSI (1 + (pf->hw.func_caps.fcoe ? 1 : 0) \ in i40e_get_capabilities()
10570 + pf->hw.func_caps.num_vfs) in i40e_get_capabilities()
10571 if (pf->hw.revision_id == 0 && in i40e_get_capabilities()
10572 pf->hw.func_caps.num_vsis < DEF_NUM_VSI) { in i40e_get_capabilities()
10573 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10575 pf->hw.func_caps.num_vsis, DEF_NUM_VSI); in i40e_get_capabilities()
10576 pf->hw.func_caps.num_vsis = DEF_NUM_VSI; in i40e_get_capabilities()
10586 * @pf: board private structure
10588 static void i40e_fdir_sb_setup(struct i40e_pf *pf) in i40e_fdir_sb_setup() argument
10595 if (!rd32(&pf->hw, I40E_GLQF_HKEY(0))) { in i40e_fdir_sb_setup()
10604 wr32(&pf->hw, I40E_GLQF_HKEY(i), hkey[i]); in i40e_fdir_sb_setup()
10607 if (!test_bit(I40E_FLAG_FD_SB_ENA, pf->flags)) in i40e_fdir_sb_setup()
10611 vsi = i40e_find_vsi_by_type(pf, I40E_VSI_FDIR); in i40e_fdir_sb_setup()
10615 main_vsi = i40e_pf_get_main_vsi(pf); in i40e_fdir_sb_setup()
10616 vsi = i40e_vsi_setup(pf, I40E_VSI_FDIR, main_vsi->seid, 0); in i40e_fdir_sb_setup()
10618 dev_info(&pf->pdev->dev, "Couldn't create FDir VSI\n"); in i40e_fdir_sb_setup()
10619 clear_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_fdir_sb_setup()
10620 set_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_fdir_sb_setup()
10630 * @pf: board private structure
10632 static void i40e_fdir_teardown(struct i40e_pf *pf) in i40e_fdir_teardown() argument
10636 i40e_fdir_filter_exit(pf); in i40e_fdir_teardown()
10637 vsi = i40e_find_vsi_by_type(pf, I40E_VSI_FDIR); in i40e_fdir_teardown()
10644 * @vsi: PF main vsi
10653 struct i40e_pf *pf = vsi->back; in i40e_rebuild_cloud_filters() local
10658 hlist_for_each_entry_safe(cfilter, node, &pf->cloud_filter_list, in i40e_rebuild_cloud_filters()
10670 dev_dbg(&pf->pdev->dev, in i40e_rebuild_cloud_filters()
10673 i40e_aq_str(&pf->hw, in i40e_rebuild_cloud_filters()
10674 pf->hw.aq.asq_last_status)); in i40e_rebuild_cloud_filters()
10683 * @vsi: PF main vsi
10759 * @pf: board private structure
10761 * Close up the VFs and other things in prep for PF Reset.
10763 static void i40e_prep_for_reset(struct i40e_pf *pf) in i40e_prep_for_reset() argument
10765 struct i40e_hw *hw = &pf->hw; in i40e_prep_for_reset()
10770 clear_bit(__I40E_RESET_INTR_RECEIVED, pf->state); in i40e_prep_for_reset()
10771 if (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_prep_for_reset()
10773 if (i40e_check_asq_alive(&pf->hw)) in i40e_prep_for_reset()
10774 i40e_vc_notify_reset(pf); in i40e_prep_for_reset()
10776 dev_dbg(&pf->pdev->dev, "Tearing down internal switch for reset\n"); in i40e_prep_for_reset()
10779 i40e_pf_quiesce_all_vsi(pf); in i40e_prep_for_reset()
10781 i40e_pf_for_each_vsi(pf, v, vsi) { in i40e_prep_for_reset()
10786 i40e_shutdown_adminq(&pf->hw); in i40e_prep_for_reset()
10792 dev_warn(&pf->pdev->dev, in i40e_prep_for_reset()
10799 i40e_ptp_save_hw_time(pf); in i40e_prep_for_reset()
10804 * @pf: PF struct
10806 static void i40e_send_version(struct i40e_pf *pf) in i40e_send_version() argument
10815 i40e_aq_send_driver_version(&pf->hw, &dv, NULL); in i40e_send_version()
10866 * i40e_reset - wait for core reset to finish reset, reset pf if corer not seen
10867 * @pf: board private structure
10869 static int i40e_reset(struct i40e_pf *pf) in i40e_reset() argument
10871 struct i40e_hw *hw = &pf->hw; in i40e_reset()
10876 dev_info(&pf->pdev->dev, "PF reset failed, %d\n", ret); in i40e_reset()
10877 set_bit(__I40E_RESET_FAILED, pf->state); in i40e_reset()
10878 clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state); in i40e_reset()
10880 pf->pfr_count++; in i40e_reset()
10887 * @pf: board private structure
10892 static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) in i40e_rebuild() argument
10894 const bool is_recovery_mode_reported = i40e_check_recovery_mode(pf); in i40e_rebuild()
10895 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_rebuild()
10896 struct i40e_hw *hw = &pf->hw; in i40e_rebuild()
10902 if (test_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state) && in i40e_rebuild()
10906 if (test_bit(__I40E_DOWN, pf->state) && in i40e_rebuild()
10907 !test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_rebuild()
10909 dev_dbg(&pf->pdev->dev, "Rebuilding internal switch\n"); in i40e_rebuild()
10912 ret = i40e_init_adminq(&pf->hw); in i40e_rebuild()
10914 dev_info(&pf->pdev->dev, "Rebuild AdminQ failed, err %pe aq_err %s\n", in i40e_rebuild()
10916 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_rebuild()
10919 i40e_get_oem_version(&pf->hw); in i40e_rebuild()
10921 if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) { in i40e_rebuild()
10927 if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) in i40e_rebuild()
10928 i40e_verify_eeprom(pf); in i40e_rebuild()
10934 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_rebuild()
10935 if (i40e_get_capabilities(pf, in i40e_rebuild()
10943 if (i40e_setup_misc_vector_for_recovery_mode(pf)) in i40e_rebuild()
10952 free_irq(pf->pdev->irq, pf); in i40e_rebuild()
10953 i40e_clear_interrupt_scheme(pf); in i40e_rebuild()
10954 if (i40e_restore_interrupt_scheme(pf)) in i40e_rebuild()
10959 i40e_send_version(pf); in i40e_rebuild()
10968 ret = i40e_get_capabilities(pf, i40e_aqc_opc_list_func_capabilities); in i40e_rebuild()
10975 dev_info(&pf->pdev->dev, "init_lan_hmc failed: %d\n", ret); in i40e_rebuild()
10980 dev_info(&pf->pdev->dev, "configure_lan_hmc failed: %d\n", ret); in i40e_rebuild()
10989 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_rebuild()
10996 dev_warn(&pf->pdev->dev, in i40e_rebuild()
10998 clear_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_rebuild()
11001 ret = i40e_init_pf_dcb(pf); in i40e_rebuild()
11003 dev_info(&pf->pdev->dev, "DCB init failed %d, disabled\n", in i40e_rebuild()
11005 clear_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_rebuild()
11014 ret = i40e_setup_pf_switch(pf, reinit, true); in i40e_rebuild()
11021 ret = i40e_aq_set_phy_int_mask(&pf->hw, in i40e_rebuild()
11026 dev_info(&pf->pdev->dev, "set phy mask fail, err %pe aq_err %s\n", in i40e_rebuild()
11028 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_rebuild()
11035 * to recover minimal use by getting the basic PF VSI working. in i40e_rebuild()
11037 if (vsi->uplink_seid != pf->mac_seid) { in i40e_rebuild()
11038 dev_dbg(&pf->pdev->dev, "attempting to rebuild switch\n"); in i40e_rebuild()
11041 i40e_pf_for_each_veb(pf, v, veb) { in i40e_rebuild()
11048 * for minimal rebuild of PF VSI. in i40e_rebuild()
11052 if (veb->uplink_seid == pf->mac_seid) { in i40e_rebuild()
11053 dev_info(&pf->pdev->dev, in i40e_rebuild()
11054 "rebuild of switch failed: %d, will try to set up simple PF connection\n", in i40e_rebuild()
11056 vsi->uplink_seid = pf->mac_seid; in i40e_rebuild()
11059 dev_info(&pf->pdev->dev, in i40e_rebuild()
11066 if (vsi->uplink_seid == pf->mac_seid) { in i40e_rebuild()
11067 dev_dbg(&pf->pdev->dev, "attempting to rebuild PF VSI\n"); in i40e_rebuild()
11071 dev_info(&pf->pdev->dev, in i40e_rebuild()
11099 /* PF Main VSI is rebuild by now, go ahead and rebuild channel VSIs in i40e_rebuild()
11120 if (test_bit(I40E_HW_CAP_RESTART_AUTONEG, pf->hw.caps)) { in i40e_rebuild()
11122 ret = i40e_aq_set_link_restart_an(&pf->hw, true, NULL); in i40e_rebuild()
11124 dev_info(&pf->pdev->dev, "link restart failed, err %pe aq_err %s\n", in i40e_rebuild()
11126 i40e_aq_str(&pf->hw, in i40e_rebuild()
11127 pf->hw.aq.asq_last_status)); in i40e_rebuild()
11130 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_rebuild()
11131 ret = i40e_setup_misc_vector(pf); in i40e_rebuild()
11139 * PF/VF VSIs. in i40e_rebuild()
11142 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, in i40e_rebuild()
11143 pf->main_vsi_seid); in i40e_rebuild()
11146 i40e_pf_unquiesce_all_vsi(pf); in i40e_rebuild()
11153 ret = i40e_set_promiscuous(pf, pf->cur_promisc); in i40e_rebuild()
11155 dev_warn(&pf->pdev->dev, in i40e_rebuild()
11157 pf->cur_promisc ? "on" : "off", in i40e_rebuild()
11159 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_rebuild()
11161 i40e_reset_all_vfs(pf, true); in i40e_rebuild()
11164 i40e_send_version(pf); in i40e_rebuild()
11173 clear_bit(__I40E_RESET_FAILED, pf->state); in i40e_rebuild()
11175 clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state); in i40e_rebuild()
11176 clear_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state); in i40e_rebuild()
11181 * @pf: board private structure
11186 static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit, in i40e_reset_and_rebuild() argument
11191 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_reset_and_rebuild()
11197 ret = i40e_reset(pf); in i40e_reset_and_rebuild()
11199 i40e_rebuild(pf, reinit, lock_acquired); in i40e_reset_and_rebuild()
11201 dev_err(&pf->pdev->dev, "%s: i40e_reset() FAILED", __func__); in i40e_reset_and_rebuild()
11205 * i40e_handle_reset_warning - prep for the PF to reset, reset and rebuild
11206 * @pf: board private structure
11213 static void i40e_handle_reset_warning(struct i40e_pf *pf, bool lock_acquired) in i40e_handle_reset_warning() argument
11215 i40e_prep_for_reset(pf); in i40e_handle_reset_warning()
11216 i40e_reset_and_rebuild(pf, false, lock_acquired); in i40e_handle_reset_warning()
11221 * @pf: pointer to the PF structure
11225 static void i40e_handle_mdd_event(struct i40e_pf *pf) in i40e_handle_mdd_event() argument
11227 struct i40e_hw *hw = &pf->hw; in i40e_handle_mdd_event()
11233 if (!test_bit(__I40E_MDD_EVENT_PENDING, pf->state)) in i40e_handle_mdd_event()
11243 pf->hw.func_caps.base_queue; in i40e_handle_mdd_event()
11244 if (netif_msg_tx_err(pf)) in i40e_handle_mdd_event()
11245 …dev_info(&pf->pdev->dev, "Malicious Driver Detection event 0x%02x on TX queue %d PF number 0x%02x … in i40e_handle_mdd_event()
11255 pf->hw.func_caps.base_queue; in i40e_handle_mdd_event()
11256 if (netif_msg_rx_err(pf)) in i40e_handle_mdd_event()
11257 …dev_info(&pf->pdev->dev, "Malicious Driver Detection event 0x%02x on RX queue %d of function 0x%02… in i40e_handle_mdd_event()
11267 dev_dbg(&pf->pdev->dev, "TX driver issue detected on PF\n"); in i40e_handle_mdd_event()
11272 dev_dbg(&pf->pdev->dev, "RX driver issue detected on PF\n"); in i40e_handle_mdd_event()
11277 for (i = 0; i < pf->num_alloc_vfs && mdd_detected; i++) { in i40e_handle_mdd_event()
11278 vf = &(pf->vf[i]); in i40e_handle_mdd_event()
11283 dev_info(&pf->pdev->dev, "TX driver issue detected on VF %d\n", in i40e_handle_mdd_event()
11285 dev_info(&pf->pdev->dev, in i40e_handle_mdd_event()
11286 "Use PF Control I/F to re-enable the VF\n"); in i40e_handle_mdd_event()
11294 dev_info(&pf->pdev->dev, "RX driver issue detected on VF %d\n", in i40e_handle_mdd_event()
11296 dev_info(&pf->pdev->dev, in i40e_handle_mdd_event()
11297 "Use PF Control I/F to re-enable the VF\n"); in i40e_handle_mdd_event()
11303 clear_bit(__I40E_MDD_EVENT_PENDING, pf->state); in i40e_handle_mdd_event()
11316 struct i40e_pf *pf = container_of(work, in i40e_service_task() local
11322 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) || in i40e_service_task()
11323 test_bit(__I40E_SUSPENDED, pf->state)) in i40e_service_task()
11326 if (test_and_set_bit(__I40E_SERVICE_SCHED, pf->state)) in i40e_service_task()
11329 if (!test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_service_task()
11330 i40e_detect_recover_hung(pf); in i40e_service_task()
11331 i40e_sync_filters_subtask(pf); in i40e_service_task()
11332 i40e_reset_subtask(pf); in i40e_service_task()
11333 i40e_handle_mdd_event(pf); in i40e_service_task()
11334 i40e_vc_process_vflr_event(pf); in i40e_service_task()
11335 i40e_watchdog_subtask(pf); in i40e_service_task()
11336 i40e_fdir_reinit_subtask(pf); in i40e_service_task()
11337 if (test_and_clear_bit(__I40E_CLIENT_RESET, pf->state)) { in i40e_service_task()
11339 i40e_notify_client_of_netdev_close(pf, true); in i40e_service_task()
11341 i40e_client_subtask(pf); in i40e_service_task()
11343 pf->state)) in i40e_service_task()
11344 i40e_notify_client_of_l2_param_changes(pf); in i40e_service_task()
11346 i40e_sync_filters_subtask(pf); in i40e_service_task()
11348 i40e_reset_subtask(pf); in i40e_service_task()
11351 i40e_clean_adminq_subtask(pf); in i40e_service_task()
11355 clear_bit(__I40E_SERVICE_SCHED, pf->state); in i40e_service_task()
11361 if (time_after(jiffies, (start_time + pf->service_timer_period)) || in i40e_service_task()
11362 test_bit(__I40E_ADMINQ_EVENT_PENDING, pf->state) || in i40e_service_task()
11363 test_bit(__I40E_MDD_EVENT_PENDING, pf->state) || in i40e_service_task()
11364 test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_service_task()
11365 i40e_service_event_schedule(pf); in i40e_service_task()
11374 struct i40e_pf *pf = from_timer(pf, t, service_timer); in i40e_service_timer() local
11376 mod_timer(&pf->service_timer, in i40e_service_timer()
11377 round_jiffies(jiffies + pf->service_timer_period)); in i40e_service_timer()
11378 i40e_service_event_schedule(pf); in i40e_service_timer()
11387 struct i40e_pf *pf = vsi->back; in i40e_set_num_rings_in_vsi() local
11391 vsi->alloc_queue_pairs = pf->num_lan_qps; in i40e_set_num_rings_in_vsi()
11398 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_set_num_rings_in_vsi()
11399 vsi->num_q_vectors = pf->num_lan_msix; in i40e_set_num_rings_in_vsi()
11411 vsi->num_q_vectors = pf->num_fdsb_msix; in i40e_set_num_rings_in_vsi()
11415 vsi->alloc_queue_pairs = pf->num_vmdq_qps; in i40e_set_num_rings_in_vsi()
11422 vsi->num_q_vectors = pf->num_vmdq_msix; in i40e_set_num_rings_in_vsi()
11426 vsi->alloc_queue_pairs = pf->num_vf_qps; in i40e_set_num_rings_in_vsi()
11492 * i40e_vsi_mem_alloc - Allocates the next available struct vsi in the PF
11493 * @pf: board private structure
11497 * On success: returns vsi index in PF (positive)
11499 static int i40e_vsi_mem_alloc(struct i40e_pf *pf, enum i40e_vsi_type type) in i40e_vsi_mem_alloc() argument
11506 /* Need to protect the allocation of the VSIs at the PF level */ in i40e_vsi_mem_alloc()
11507 mutex_lock(&pf->switch_mutex); in i40e_vsi_mem_alloc()
11515 i = pf->next_vsi; in i40e_vsi_mem_alloc()
11516 while (i < pf->num_alloc_vsi && pf->vsi[i]) in i40e_vsi_mem_alloc()
11518 if (i >= pf->num_alloc_vsi) { in i40e_vsi_mem_alloc()
11520 while (i < pf->next_vsi && pf->vsi[i]) in i40e_vsi_mem_alloc()
11524 if (i < pf->num_alloc_vsi && !pf->vsi[i]) { in i40e_vsi_mem_alloc()
11530 pf->next_vsi = ++i; in i40e_vsi_mem_alloc()
11538 vsi->back = pf; in i40e_vsi_mem_alloc()
11544 pf->rss_table_size : 64; in i40e_vsi_mem_alloc()
11551 vsi->af_xdp_zc_qps = bitmap_zalloc(pf->num_lan_qps, GFP_KERNEL); in i40e_vsi_mem_alloc()
11569 pf->vsi[vsi_idx] = vsi; in i40e_vsi_mem_alloc()
11575 pf->next_vsi = i - 1; in i40e_vsi_mem_alloc()
11578 mutex_unlock(&pf->switch_mutex); in i40e_vsi_mem_alloc()
11626 struct i40e_pf *pf; in i40e_vsi_clear() local
11633 pf = vsi->back; in i40e_vsi_clear()
11635 mutex_lock(&pf->switch_mutex); in i40e_vsi_clear()
11636 if (!pf->vsi[vsi->idx]) { in i40e_vsi_clear()
11637 dev_err(&pf->pdev->dev, "pf->vsi[%d] is NULL, just free vsi[%d](type %d)\n", in i40e_vsi_clear()
11642 if (pf->vsi[vsi->idx] != vsi) { in i40e_vsi_clear()
11643 dev_err(&pf->pdev->dev, in i40e_vsi_clear()
11644 "pf->vsi[%d](type %d) != vsi[%d](type %d): no free!\n", in i40e_vsi_clear()
11645 pf->vsi[vsi->idx]->idx, in i40e_vsi_clear()
11646 pf->vsi[vsi->idx]->type, in i40e_vsi_clear()
11651 /* updates the PF for this cleared vsi */ in i40e_vsi_clear()
11652 i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx); in i40e_vsi_clear()
11653 i40e_put_lump(pf->irq_pile, vsi->base_vector, vsi->idx); in i40e_vsi_clear()
11659 pf->vsi[vsi->idx] = NULL; in i40e_vsi_clear()
11660 if (vsi->idx < pf->next_vsi) in i40e_vsi_clear()
11661 pf->next_vsi = vsi->idx; in i40e_vsi_clear()
11664 mutex_unlock(&pf->switch_mutex); in i40e_vsi_clear()
11697 struct i40e_pf *pf = vsi->back; in i40e_alloc_rings() local
11712 ring->dev = &pf->pdev->dev; in i40e_alloc_rings()
11718 ring->itr_setting = pf->tx_itr_default; in i40e_alloc_rings()
11729 ring->dev = &pf->pdev->dev; in i40e_alloc_rings()
11736 ring->itr_setting = pf->tx_itr_default; in i40e_alloc_rings()
11745 ring->dev = &pf->pdev->dev; in i40e_alloc_rings()
11749 ring->itr_setting = pf->rx_itr_default; in i40e_alloc_rings()
11762 * @pf: board private structure
11767 static int i40e_reserve_msix_vectors(struct i40e_pf *pf, int vectors) in i40e_reserve_msix_vectors() argument
11769 vectors = pci_enable_msix_range(pf->pdev, pf->msix_entries, in i40e_reserve_msix_vectors()
11772 dev_info(&pf->pdev->dev, in i40e_reserve_msix_vectors()
11782 * @pf: board private structure
11788 static int i40e_init_msix(struct i40e_pf *pf) in i40e_init_msix() argument
11790 struct i40e_hw *hw = &pf->hw; in i40e_init_msix()
11797 if (!test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_init_msix()
11824 /* reserve some vectors for the main PF traffic queues. Initially we in i40e_init_msix()
11832 pf->num_lan_msix = min_t(int, cpus, vectors_left / 2); in i40e_init_msix()
11833 vectors_left -= pf->num_lan_msix; in i40e_init_msix()
11836 if (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags)) { in i40e_init_msix()
11838 pf->num_fdsb_msix = 1; in i40e_init_msix()
11842 pf->num_fdsb_msix = 0; in i40e_init_msix()
11847 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags)) { in i40e_init_msix()
11848 iwarp_requested = pf->num_iwarp_msix; in i40e_init_msix()
11851 pf->num_iwarp_msix = 0; in i40e_init_msix()
11852 else if (vectors_left < pf->num_iwarp_msix) in i40e_init_msix()
11853 pf->num_iwarp_msix = 1; in i40e_init_msix()
11854 v_budget += pf->num_iwarp_msix; in i40e_init_msix()
11855 vectors_left -= pf->num_iwarp_msix; in i40e_init_msix()
11859 if (test_bit(I40E_FLAG_VMDQ_ENA, pf->flags)) { in i40e_init_msix()
11861 pf->num_vmdq_msix = 0; in i40e_init_msix()
11862 pf->num_vmdq_qps = 0; in i40e_init_msix()
11865 pf->num_vmdq_vsis * pf->num_vmdq_qps; in i40e_init_msix()
11872 * queues/vectors used by the PF later with the ethtool in i40e_init_msix()
11876 pf->num_vmdq_qps = 1; in i40e_init_msix()
11877 vmdq_vecs_wanted = pf->num_vmdq_vsis; in i40e_init_msix()
11882 pf->num_vmdq_msix = pf->num_vmdq_qps; in i40e_init_msix()
11898 extra_vectors = min_t(int, cpus - pf->num_lan_msix, vectors_left); in i40e_init_msix()
11899 pf->num_lan_msix += extra_vectors; in i40e_init_msix()
11905 v_budget += pf->num_lan_msix; in i40e_init_msix()
11906 pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry), in i40e_init_msix()
11908 if (!pf->msix_entries) in i40e_init_msix()
11912 pf->msix_entries[i].entry = i; in i40e_init_msix()
11913 v_actual = i40e_reserve_msix_vectors(pf, v_budget); in i40e_init_msix()
11916 clear_bit(I40E_FLAG_MSIX_ENA, pf->flags); in i40e_init_msix()
11917 kfree(pf->msix_entries); in i40e_init_msix()
11918 pf->msix_entries = NULL; in i40e_init_msix()
11919 pci_disable_msix(pf->pdev); in i40e_init_msix()
11924 pf->num_vmdq_vsis = 0; in i40e_init_msix()
11925 pf->num_vmdq_qps = 0; in i40e_init_msix()
11926 pf->num_lan_qps = 1; in i40e_init_msix()
11927 pf->num_lan_msix = 1; in i40e_init_msix()
11937 dev_info(&pf->pdev->dev, in i40e_init_msix()
11944 pf->num_vmdq_msix = 1; /* force VMDqs to only one vector */ in i40e_init_msix()
11945 pf->num_vmdq_vsis = 1; in i40e_init_msix()
11946 pf->num_vmdq_qps = 1; in i40e_init_msix()
11951 pf->num_lan_msix = 1; in i40e_init_msix()
11954 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags)) { in i40e_init_msix()
11955 pf->num_lan_msix = 1; in i40e_init_msix()
11956 pf->num_iwarp_msix = 1; in i40e_init_msix()
11958 pf->num_lan_msix = 2; in i40e_init_msix()
11962 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags)) { in i40e_init_msix()
11963 pf->num_iwarp_msix = min_t(int, (vec / 3), in i40e_init_msix()
11965 pf->num_vmdq_vsis = min_t(int, (vec / 3), in i40e_init_msix()
11968 pf->num_vmdq_vsis = min_t(int, (vec / 2), in i40e_init_msix()
11971 if (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags)) { in i40e_init_msix()
11972 pf->num_fdsb_msix = 1; in i40e_init_msix()
11975 pf->num_lan_msix = min_t(int, in i40e_init_msix()
11976 (vec - (pf->num_iwarp_msix + pf->num_vmdq_vsis)), in i40e_init_msix()
11977 pf->num_lan_msix); in i40e_init_msix()
11978 pf->num_lan_qps = pf->num_lan_msix; in i40e_init_msix()
11983 if (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags) && pf->num_fdsb_msix == 0) { in i40e_init_msix()
11984 dev_info(&pf->pdev->dev, "Sideband Flowdir disabled, not enough MSI-X vectors\n"); in i40e_init_msix()
11985 clear_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_init_msix()
11986 set_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_init_msix()
11988 if (test_bit(I40E_FLAG_VMDQ_ENA, pf->flags) && pf->num_vmdq_msix == 0) { in i40e_init_msix()
11989 dev_info(&pf->pdev->dev, "VMDq disabled, not enough MSI-X vectors\n"); in i40e_init_msix()
11990 clear_bit(I40E_FLAG_VMDQ_ENA, pf->flags); in i40e_init_msix()
11993 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags) && in i40e_init_msix()
11994 pf->num_iwarp_msix == 0) { in i40e_init_msix()
11995 dev_info(&pf->pdev->dev, "IWARP disabled, not enough MSI-X vectors\n"); in i40e_init_msix()
11996 clear_bit(I40E_FLAG_IWARP_ENA, pf->flags); in i40e_init_msix()
11998 i40e_debug(&pf->hw, I40E_DEBUG_INIT, in i40e_init_msix()
11999 "MSI-X vector distribution: PF %d, VMDq %d, FDSB %d, iWARP %d\n", in i40e_init_msix()
12000 pf->num_lan_msix, in i40e_init_msix()
12001 pf->num_vmdq_msix * pf->num_vmdq_vsis, in i40e_init_msix()
12002 pf->num_fdsb_msix, in i40e_init_msix()
12003 pf->num_iwarp_msix); in i40e_init_msix()
12046 struct i40e_pf *pf = vsi->back; in i40e_vsi_alloc_q_vectors() local
12050 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_vsi_alloc_q_vectors()
12074 * @pf: board private structure to initialize
12076 static int i40e_init_interrupt_scheme(struct i40e_pf *pf) in i40e_init_interrupt_scheme() argument
12081 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_init_interrupt_scheme()
12082 vectors = i40e_init_msix(pf); in i40e_init_interrupt_scheme()
12084 clear_bit(I40E_FLAG_MSIX_ENA, pf->flags); in i40e_init_interrupt_scheme()
12085 clear_bit(I40E_FLAG_IWARP_ENA, pf->flags); in i40e_init_interrupt_scheme()
12086 clear_bit(I40E_FLAG_RSS_ENA, pf->flags); in i40e_init_interrupt_scheme()
12087 clear_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_init_interrupt_scheme()
12088 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_init_interrupt_scheme()
12089 clear_bit(I40E_FLAG_SRIOV_ENA, pf->flags); in i40e_init_interrupt_scheme()
12090 clear_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_init_interrupt_scheme()
12091 clear_bit(I40E_FLAG_FD_ATR_ENA, pf->flags); in i40e_init_interrupt_scheme()
12092 clear_bit(I40E_FLAG_VMDQ_ENA, pf->flags); in i40e_init_interrupt_scheme()
12093 set_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_init_interrupt_scheme()
12096 i40e_determine_queue_usage(pf); in i40e_init_interrupt_scheme()
12100 if (!test_bit(I40E_FLAG_MSIX_ENA, pf->flags) && in i40e_init_interrupt_scheme()
12101 test_bit(I40E_FLAG_MSI_ENA, pf->flags)) { in i40e_init_interrupt_scheme()
12102 dev_info(&pf->pdev->dev, "MSI-X not available, trying MSI\n"); in i40e_init_interrupt_scheme()
12103 vectors = pci_enable_msi(pf->pdev); in i40e_init_interrupt_scheme()
12105 dev_info(&pf->pdev->dev, "MSI init failed - %d\n", in i40e_init_interrupt_scheme()
12107 clear_bit(I40E_FLAG_MSI_ENA, pf->flags); in i40e_init_interrupt_scheme()
12112 if (!test_bit(I40E_FLAG_MSI_ENA, pf->flags) && in i40e_init_interrupt_scheme()
12113 !test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_init_interrupt_scheme()
12114 dev_info(&pf->pdev->dev, "MSI-X and MSI not available, falling back to Legacy IRQ\n"); in i40e_init_interrupt_scheme()
12118 pf->irq_pile = kzalloc(size, GFP_KERNEL); in i40e_init_interrupt_scheme()
12119 if (!pf->irq_pile) in i40e_init_interrupt_scheme()
12122 pf->irq_pile->num_entries = vectors; in i40e_init_interrupt_scheme()
12125 (void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1); in i40e_init_interrupt_scheme()
12132 * @pf: private board data structure
12138 static int i40e_restore_interrupt_scheme(struct i40e_pf *pf) in i40e_restore_interrupt_scheme() argument
12147 set_bit(I40E_FLAG_MSI_ENA, pf->flags); in i40e_restore_interrupt_scheme()
12148 set_bit(I40E_FLAG_MSIX_ENA, pf->flags); in i40e_restore_interrupt_scheme()
12150 err = i40e_init_interrupt_scheme(pf); in i40e_restore_interrupt_scheme()
12157 i40e_pf_for_each_vsi(pf, i, vsi) { in i40e_restore_interrupt_scheme()
12165 err = i40e_setup_misc_vector(pf); in i40e_restore_interrupt_scheme()
12169 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags)) in i40e_restore_interrupt_scheme()
12170 i40e_client_update_msix_info(pf); in i40e_restore_interrupt_scheme()
12176 if (pf->vsi[i]) in i40e_restore_interrupt_scheme()
12177 i40e_vsi_free_q_vectors(pf->vsi[i]); in i40e_restore_interrupt_scheme()
12186 * @pf: board private structure
12193 static int i40e_setup_misc_vector_for_recovery_mode(struct i40e_pf *pf) in i40e_setup_misc_vector_for_recovery_mode() argument
12197 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_setup_misc_vector_for_recovery_mode()
12198 err = i40e_setup_misc_vector(pf); in i40e_setup_misc_vector_for_recovery_mode()
12201 dev_info(&pf->pdev->dev, in i40e_setup_misc_vector_for_recovery_mode()
12207 u32 flags = test_bit(I40E_FLAG_MSI_ENA, pf->flags) ? 0 : IRQF_SHARED; in i40e_setup_misc_vector_for_recovery_mode()
12209 err = request_irq(pf->pdev->irq, i40e_intr, flags, in i40e_setup_misc_vector_for_recovery_mode()
12210 pf->int_name, pf); in i40e_setup_misc_vector_for_recovery_mode()
12213 dev_info(&pf->pdev->dev, in i40e_setup_misc_vector_for_recovery_mode()
12218 i40e_enable_misc_int_causes(pf); in i40e_setup_misc_vector_for_recovery_mode()
12219 i40e_irq_dynamic_enable_icr0(pf); in i40e_setup_misc_vector_for_recovery_mode()
12227 * @pf: board private structure
12233 static int i40e_setup_misc_vector(struct i40e_pf *pf) in i40e_setup_misc_vector() argument
12235 struct i40e_hw *hw = &pf->hw; in i40e_setup_misc_vector()
12239 if (!test_and_set_bit(__I40E_MISC_IRQ_REQUESTED, pf->state)) { in i40e_setup_misc_vector()
12240 err = request_irq(pf->msix_entries[0].vector, in i40e_setup_misc_vector()
12241 i40e_intr, 0, pf->int_name, pf); in i40e_setup_misc_vector()
12243 clear_bit(__I40E_MISC_IRQ_REQUESTED, pf->state); in i40e_setup_misc_vector()
12244 dev_info(&pf->pdev->dev, in i40e_setup_misc_vector()
12246 pf->int_name, err); in i40e_setup_misc_vector()
12251 i40e_enable_misc_int_causes(pf); in i40e_setup_misc_vector()
12259 i40e_irq_dynamic_enable_icr0(pf); in i40e_setup_misc_vector()
12276 struct i40e_pf *pf = vsi->back; in i40e_get_rss_aq() local
12277 struct i40e_hw *hw = &pf->hw; in i40e_get_rss_aq()
12284 dev_info(&pf->pdev->dev, in i40e_get_rss_aq()
12287 i40e_aq_str(&pf->hw, in i40e_get_rss_aq()
12288 pf->hw.aq.asq_last_status)); in i40e_get_rss_aq()
12298 dev_info(&pf->pdev->dev, in i40e_get_rss_aq()
12301 i40e_aq_str(&pf->hw, in i40e_get_rss_aq()
12302 pf->hw.aq.asq_last_status)); in i40e_get_rss_aq()
12322 struct i40e_pf *pf = vsi->back; in i40e_config_rss_reg() local
12323 struct i40e_hw *hw = &pf->hw; in i40e_config_rss_reg()
12338 dev_err(&pf->pdev->dev, "Cannot set RSS seed - invalid VSI type\n"); in i40e_config_rss_reg()
12356 dev_err(&pf->pdev->dev, "Cannot set RSS LUT - invalid VSI type\n"); in i40e_config_rss_reg()
12376 struct i40e_pf *pf = vsi->back; in i40e_get_rss_reg() local
12377 struct i40e_hw *hw = &pf->hw; in i40e_get_rss_reg()
12409 struct i40e_pf *pf = vsi->back; in i40e_config_rss() local
12411 if (test_bit(I40E_HW_CAP_RSS_AQ, pf->hw.caps)) in i40e_config_rss()
12428 struct i40e_pf *pf = vsi->back; in i40e_get_rss() local
12430 if (test_bit(I40E_HW_CAP_RSS_AQ, pf->hw.caps)) in i40e_get_rss()
12438 * @pf: Pointer to board private structure
12443 void i40e_fill_rss_lut(struct i40e_pf *pf, u8 *lut, in i40e_fill_rss_lut() argument
12454 * @pf: board private structure
12456 static int i40e_pf_config_rss(struct i40e_pf *pf) in i40e_pf_config_rss() argument
12458 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_pf_config_rss()
12461 struct i40e_hw *hw = &pf->hw; in i40e_pf_config_rss()
12469 hena |= i40e_pf_get_default_rss_hena(pf); in i40e_pf_config_rss()
12476 reg_val = (pf->rss_table_size == 512) ? in i40e_pf_config_rss()
12491 vsi->rss_size = min_t(int, pf->alloc_rss_size, qcount); in i40e_pf_config_rss()
12504 i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size); in i40e_pf_config_rss()
12521 * @pf: board private structure
12528 int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count) in i40e_reconfig_rss_queues() argument
12530 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); in i40e_reconfig_rss_queues()
12533 if (!test_bit(I40E_FLAG_RSS_ENA, pf->flags)) in i40e_reconfig_rss_queues()
12537 new_rss_size = min_t(int, queue_count, pf->rss_size_max); in i40e_reconfig_rss_queues()
12543 i40e_prep_for_reset(pf); in i40e_reconfig_rss_queues()
12544 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_reconfig_rss_queues()
12545 return pf->alloc_rss_size; in i40e_reconfig_rss_queues()
12547 pf->alloc_rss_size = new_rss_size; in i40e_reconfig_rss_queues()
12549 i40e_reset_and_rebuild(pf, true, true); in i40e_reconfig_rss_queues()
12556 dev_dbg(&pf->pdev->dev, in i40e_reconfig_rss_queues()
12562 vsi->rss_size = min_t(int, pf->alloc_rss_size, qcount); in i40e_reconfig_rss_queues()
12564 i40e_pf_config_rss(pf); in i40e_reconfig_rss_queues()
12566 dev_info(&pf->pdev->dev, "User requested queue count/HW max RSS count: %d/%d\n", in i40e_reconfig_rss_queues()
12567 vsi->req_queue_pairs, pf->rss_size_max); in i40e_reconfig_rss_queues()
12568 return pf->alloc_rss_size; in i40e_reconfig_rss_queues()
12572 * i40e_get_partition_bw_setting - Retrieve BW settings for this PF partition
12573 * @pf: board private structure
12575 int i40e_get_partition_bw_setting(struct i40e_pf *pf) in i40e_get_partition_bw_setting() argument
12581 status = i40e_read_bw_from_alt_ram(&pf->hw, &max_bw, &min_bw, in i40e_get_partition_bw_setting()
12586 pf->min_bw = min_bw; in i40e_get_partition_bw_setting()
12588 pf->max_bw = max_bw; in i40e_get_partition_bw_setting()
12595 * i40e_set_partition_bw_setting - Set BW settings for this PF partition
12596 * @pf: board private structure
12598 int i40e_set_partition_bw_setting(struct i40e_pf *pf) in i40e_set_partition_bw_setting() argument
12605 /* Set the valid bit for this PF */ in i40e_set_partition_bw_setting()
12606 bw_data.pf_valid_bits = cpu_to_le16(BIT(pf->hw.pf_id)); in i40e_set_partition_bw_setting()
12607 bw_data.max_bw[pf->hw.pf_id] = pf->max_bw & I40E_ALT_BW_VALUE_MASK; in i40e_set_partition_bw_setting()
12608 bw_data.min_bw[pf->hw.pf_id] = pf->min_bw & I40E_ALT_BW_VALUE_MASK; in i40e_set_partition_bw_setting()
12611 status = i40e_aq_configure_partition_bw(&pf->hw, &bw_data, NULL); in i40e_set_partition_bw_setting()
12617 * i40e_commit_partition_bw_setting - Commit BW settings for this PF partition
12618 * @pf: board private structure
12620 int i40e_commit_partition_bw_setting(struct i40e_pf *pf) in i40e_commit_partition_bw_setting() argument
12627 if (pf->hw.partition_id != 1) { in i40e_commit_partition_bw_setting()
12628 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12630 pf->hw.partition_id); in i40e_commit_partition_bw_setting()
12636 ret = i40e_acquire_nvm(&pf->hw, I40E_RESOURCE_READ); in i40e_commit_partition_bw_setting()
12637 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12639 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12642 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12647 ret = i40e_aq_read_nvm(&pf->hw, in i40e_commit_partition_bw_setting()
12654 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12655 i40e_release_nvm(&pf->hw); in i40e_commit_partition_bw_setting()
12657 dev_info(&pf->pdev->dev, "NVM read error, err %pe aq_err %s\n", in i40e_commit_partition_bw_setting()
12659 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12667 ret = i40e_acquire_nvm(&pf->hw, I40E_RESOURCE_WRITE); in i40e_commit_partition_bw_setting()
12668 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12670 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12673 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12680 ret = i40e_aq_update_nvm(&pf->hw, in i40e_commit_partition_bw_setting()
12687 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12688 i40e_release_nvm(&pf->hw); in i40e_commit_partition_bw_setting()
12690 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12693 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12701 * if total port shutdown feature is enabled for this PF
12702 * @pf: board private structure
12704 static bool i40e_is_total_port_shutdown_enabled(struct i40e_pf *pf) in i40e_is_total_port_shutdown_enabled() argument
12719 read_status = i40e_read_nvm_word(&pf->hw, in i40e_is_total_port_shutdown_enabled()
12724 read_status = i40e_read_nvm_word(&pf->hw, in i40e_is_total_port_shutdown_enabled()
12731 read_status = i40e_read_nvm_module_data(&pf->hw, in i40e_is_total_port_shutdown_enabled()
12739 link_behavior >>= (pf->hw.port * I40E_LINK_BEHAVIOR_PORT_BIT_LENGTH); in i40e_is_total_port_shutdown_enabled()
12745 dev_warn(&pf->pdev->dev, in i40e_is_total_port_shutdown_enabled()
12753 * @pf: board private structure to initialize
12759 static int i40e_sw_init(struct i40e_pf *pf) in i40e_sw_init() argument
12766 bitmap_zero(pf->flags, I40E_PF_FLAGS_NBITS); in i40e_sw_init()
12767 set_bit(I40E_FLAG_MSI_ENA, pf->flags); in i40e_sw_init()
12768 set_bit(I40E_FLAG_MSIX_ENA, pf->flags); in i40e_sw_init()
12771 pf->rx_itr_default = I40E_ITR_RX_DEF; in i40e_sw_init()
12772 pf->tx_itr_default = I40E_ITR_TX_DEF; in i40e_sw_init()
12774 /* Depending on PF configurations, it is possible that the RSS in i40e_sw_init()
12777 pf->rss_size_max = BIT(pf->hw.func_caps.rss_table_entry_width); in i40e_sw_init()
12778 pf->alloc_rss_size = 1; in i40e_sw_init()
12779 pf->rss_table_size = pf->hw.func_caps.rss_table_size; in i40e_sw_init()
12780 pf->rss_size_max = min_t(int, pf->rss_size_max, in i40e_sw_init()
12781 pf->hw.func_caps.num_tx_qp); in i40e_sw_init()
12785 pf->rss_size_max = min_t(int, pf->rss_size_max, pow); in i40e_sw_init()
12787 if (pf->hw.func_caps.rss) { in i40e_sw_init()
12788 set_bit(I40E_FLAG_RSS_ENA, pf->flags); in i40e_sw_init()
12789 pf->alloc_rss_size = min_t(int, pf->rss_size_max, in i40e_sw_init()
12794 if (pf->hw.func_caps.npar_enable || pf->hw.func_caps.flex10_enable) { in i40e_sw_init()
12795 set_bit(I40E_FLAG_MFP_ENA, pf->flags); in i40e_sw_init()
12796 dev_info(&pf->pdev->dev, "MFP mode Enabled\n"); in i40e_sw_init()
12797 if (i40e_get_partition_bw_setting(pf)) { in i40e_sw_init()
12798 dev_warn(&pf->pdev->dev, in i40e_sw_init()
12801 dev_info(&pf->pdev->dev, in i40e_sw_init()
12803 pf->min_bw, pf->max_bw); in i40e_sw_init()
12806 i40e_set_partition_bw_setting(pf); in i40e_sw_init()
12810 if ((pf->hw.func_caps.fd_filters_guaranteed > 0) || in i40e_sw_init()
12811 (pf->hw.func_caps.fd_filters_best_effort > 0)) { in i40e_sw_init()
12812 set_bit(I40E_FLAG_FD_ATR_ENA, pf->flags); in i40e_sw_init()
12813 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags) && in i40e_sw_init()
12814 pf->hw.num_partitions > 1) in i40e_sw_init()
12815 dev_info(&pf->pdev->dev, in i40e_sw_init()
12818 set_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_sw_init()
12819 pf->fdir_pf_filter_count = in i40e_sw_init()
12820 pf->hw.func_caps.fd_filters_guaranteed; in i40e_sw_init()
12821 pf->hw.fdir_shared_filter_count = in i40e_sw_init()
12822 pf->hw.func_caps.fd_filters_best_effort; in i40e_sw_init()
12826 if (test_bit(I40E_HW_CAP_ATR_EVICT, pf->hw.caps)) in i40e_sw_init()
12827 set_bit(I40E_FLAG_HW_ATR_EVICT_ENA, pf->flags); in i40e_sw_init()
12829 if (pf->hw.func_caps.vmdq && num_online_cpus() != 1) { in i40e_sw_init()
12830 pf->num_vmdq_vsis = I40E_DEFAULT_NUM_VMDQ_VSI; in i40e_sw_init()
12831 set_bit(I40E_FLAG_VMDQ_ENA, pf->flags); in i40e_sw_init()
12832 pf->num_vmdq_qps = i40e_default_queues_per_vmdq(pf); in i40e_sw_init()
12835 if (pf->hw.func_caps.iwarp && num_online_cpus() != 1) { in i40e_sw_init()
12836 set_bit(I40E_FLAG_IWARP_ENA, pf->flags); in i40e_sw_init()
12838 pf->num_iwarp_msix = (int)num_online_cpus() + 1; in i40e_sw_init()
12845 if (pf->hw.mac.type == I40E_MAC_XL710 && in i40e_sw_init()
12846 pf->hw.func_caps.npar_enable) in i40e_sw_init()
12847 clear_bit(I40E_HW_CAP_FW_LLDP_STOPPABLE, pf->hw.caps); in i40e_sw_init()
12850 if (pf->hw.func_caps.num_vfs && pf->hw.partition_id == 1) { in i40e_sw_init()
12851 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_sw_init()
12852 set_bit(I40E_FLAG_SRIOV_ENA, pf->flags); in i40e_sw_init()
12853 pf->num_req_vfs = min_t(int, in i40e_sw_init()
12854 pf->hw.func_caps.num_vfs, in i40e_sw_init()
12858 pf->lan_veb = I40E_NO_VEB; in i40e_sw_init()
12859 pf->lan_vsi = I40E_NO_VSI; in i40e_sw_init()
12862 clear_bit(I40E_FLAG_VEB_STATS_ENA, pf->flags); in i40e_sw_init()
12866 + (sizeof(u16) * pf->hw.func_caps.num_tx_qp); in i40e_sw_init()
12867 pf->qp_pile = kzalloc(size, GFP_KERNEL); in i40e_sw_init()
12868 if (!pf->qp_pile) { in i40e_sw_init()
12872 pf->qp_pile->num_entries = pf->hw.func_caps.num_tx_qp; in i40e_sw_init()
12874 pf->tx_timeout_recovery_level = 1; in i40e_sw_init()
12876 if (pf->hw.mac.type != I40E_MAC_X722 && in i40e_sw_init()
12877 i40e_is_total_port_shutdown_enabled(pf)) { in i40e_sw_init()
12881 set_bit(I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENA, pf->flags); in i40e_sw_init()
12882 set_bit(I40E_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags); in i40e_sw_init()
12883 dev_info(&pf->pdev->dev, in i40e_sw_init()
12886 mutex_init(&pf->switch_mutex); in i40e_sw_init()
12894 * @pf: board private structure to initialize
12899 bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features) in i40e_set_ntuple() argument
12908 if (!test_bit(I40E_FLAG_FD_SB_ENA, pf->flags)) in i40e_set_ntuple()
12913 if (pf->num_fdsb_msix > 0 && !pf->num_cloud_filters) { in i40e_set_ntuple()
12914 set_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_set_ntuple()
12915 clear_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_set_ntuple()
12919 if (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags)) { in i40e_set_ntuple()
12921 i40e_fdir_filter_exit(pf); in i40e_set_ntuple()
12923 clear_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_set_ntuple()
12924 clear_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state); in i40e_set_ntuple()
12925 set_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_set_ntuple()
12928 pf->fd_add_err = 0; in i40e_set_ntuple()
12929 pf->fd_atr_cnt = 0; in i40e_set_ntuple()
12931 if (test_and_clear_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state)) in i40e_set_ntuple()
12932 if (test_bit(I40E_FLAG_FD_ATR_ENA, pf->flags) && in i40e_set_ntuple()
12933 (I40E_DEBUG_FD & pf->hw.debug_mask)) in i40e_set_ntuple()
12934 dev_info(&pf->pdev->dev, "ATR re-enabled.\n"); in i40e_set_ntuple()
12945 struct i40e_pf *pf = vsi->back; in i40e_clear_rss_lut() local
12946 struct i40e_hw *hw = &pf->hw; in i40e_clear_rss_lut()
12957 dev_err(&pf->pdev->dev, "Cannot set RSS LUT - invalid VSI type\n"); in i40e_clear_rss_lut()
12962 * i40e_set_loopback - turn on/off loopback mode on underlying PF
12995 struct i40e_pf *pf = vsi->back; in i40e_set_features() local
12999 i40e_pf_config_rss(pf); in i40e_set_features()
13010 (netdev->features & NETIF_F_HW_TC) && pf->num_cloud_filters) { in i40e_set_features()
13011 dev_err(&pf->pdev->dev, in i40e_set_features()
13019 need_reset = i40e_set_ntuple(pf, features); in i40e_set_features()
13022 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_set_features()
13078 struct i40e_pf *pf = np->vsi->back; in i40e_get_phys_port_id() local
13079 struct i40e_hw *hw = &pf->hw; in i40e_get_phys_port_id()
13081 if (!test_bit(I40E_HW_CAP_PORT_ID_VALID, pf->hw.caps)) in i40e_get_phys_port_id()
13108 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_fdb_add() local
13111 if (!test_bit(I40E_FLAG_SRIOV_ENA, pf->flags)) in i40e_ndo_fdb_add()
13151 * is to change the mode then that requires a PF reset to
13164 struct i40e_pf *pf = vsi->back; in i40e_ndo_bridge_setlink() local
13169 /* Only for PF VSI for now */ in i40e_ndo_bridge_setlink()
13173 /* Find the HW bridge for PF VSI */ in i40e_ndo_bridge_setlink()
13174 veb = i40e_pf_get_veb_by_seid(pf, vsi->uplink_seid); in i40e_ndo_bridge_setlink()
13189 veb = i40e_veb_setup(pf, vsi->uplink_seid, vsi->seid, in i40e_ndo_bridge_setlink()
13204 set_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_ndo_bridge_setlink()
13206 clear_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_ndo_bridge_setlink()
13207 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_ndo_bridge_setlink()
13234 struct i40e_pf *pf = vsi->back; in i40e_ndo_bridge_getlink() local
13237 /* Only for PF VSI for now */ in i40e_ndo_bridge_getlink()
13241 /* Find the HW bridge for the PF VSI */ in i40e_ndo_bridge_getlink()
13242 veb = i40e_pf_get_veb_by_seid(pf, vsi->uplink_seid); in i40e_ndo_bridge_getlink()
13318 struct i40e_pf *pf = vsi->back; in i40e_xdp_setup() local
13324 if (prog && test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_xdp_setup()
13336 i40e_prep_for_reset(pf); in i40e_xdp_setup()
13346 i40e_reset_and_rebuild(pf, true, true); in i40e_xdp_setup()
13385 struct i40e_pf *pf = vsi->back; in i40e_enter_busy_conf() local
13388 while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) { in i40e_enter_busy_conf()
13404 struct i40e_pf *pf = vsi->back; in i40e_exit_busy_conf() local
13406 clear_bit(__I40E_CONFIG_BUSY, pf->state); in i40e_exit_busy_conf()
13479 struct i40e_pf *pf = vsi->back; in i40e_queue_pair_toggle_rings() local
13483 ret = i40e_control_wait_tx_q(vsi->seid, pf, pf_q, in i40e_queue_pair_toggle_rings()
13486 dev_info(&pf->pdev->dev, in i40e_queue_pair_toggle_rings()
13492 i40e_control_rx_q(pf, pf_q, enable); in i40e_queue_pair_toggle_rings()
13493 ret = i40e_pf_rxq_wait(pf, pf_q, enable); in i40e_queue_pair_toggle_rings()
13495 dev_info(&pf->pdev->dev, in i40e_queue_pair_toggle_rings()
13510 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_queue_pair_toggle_rings()
13514 dev_info(&pf->pdev->dev, in i40e_queue_pair_toggle_rings()
13530 struct i40e_pf *pf = vsi->back; in i40e_queue_pair_enable_irq() local
13531 struct i40e_hw *hw = &pf->hw; in i40e_queue_pair_enable_irq()
13534 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_queue_pair_enable_irq()
13537 i40e_irq_dynamic_enable_icr0(pf); in i40e_queue_pair_enable_irq()
13550 struct i40e_pf *pf = vsi->back; in i40e_queue_pair_disable_irq() local
13551 struct i40e_hw *hw = &pf->hw; in i40e_queue_pair_disable_irq()
13559 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_queue_pair_disable_irq()
13564 synchronize_irq(pf->msix_entries[intpf].vector); in i40e_queue_pair_disable_irq()
13570 synchronize_irq(pf->pdev->irq); in i40e_queue_pair_disable_irq()
13705 struct i40e_pf *pf = vsi->back; in i40e_config_netdev() local
13706 struct i40e_hw *hw = &pf->hw; in i40e_config_netdev()
13744 if (!test_bit(I40E_HW_CAP_OUTER_UDP_CSUM, pf->hw.caps)) in i40e_config_netdev()
13747 netdev->udp_tunnel_nic_info = &pf->udp_tunnel_nic; in i40e_config_netdev()
13780 if (!test_bit(I40E_FLAG_MFP_ENA, pf->flags)) in i40e_config_netdev()
13791 SET_NETDEV_DEV(netdev, &pf->pdev->dev); in i40e_config_netdev()
13819 struct i40e_vsi *main_vsi = i40e_pf_get_main_vsi(pf); in i40e_config_netdev()
13894 struct i40e_pf *pf = vsi->back; in i40e_is_vsi_uplink_mode_veb() local
13900 veb = pf->veb[vsi->veb_idx]; in i40e_is_vsi_uplink_mode_veb()
13902 dev_info(&pf->pdev->dev, in i40e_is_vsi_uplink_mode_veb()
13929 struct i40e_pf *pf = vsi->back; in i40e_add_vsi() local
13930 struct i40e_hw *hw = &pf->hw; in i40e_add_vsi()
13942 /* The PF's main VSI is already setup as part of the in i40e_add_vsi()
13947 ctxt.seid = pf->main_vsi_seid; in i40e_add_vsi()
13948 ctxt.pf_num = pf->hw.pf_id; in i40e_add_vsi()
13950 ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); in i40e_add_vsi()
13953 dev_info(&pf->pdev->dev, in i40e_add_vsi()
13954 "couldn't get PF vsi config, err %pe aq_err %s\n", in i40e_add_vsi()
13956 i40e_aq_str(&pf->hw, in i40e_add_vsi()
13957 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
13966 enabled_tc = i40e_pf_get_tc_map(pf); in i40e_add_vsi()
13972 if (test_bit(I40E_FLAG_SOURCE_PRUNING_DIS, pf->flags)) { in i40e_add_vsi()
13974 ctxt.seid = pf->main_vsi_seid; in i40e_add_vsi()
13975 ctxt.pf_num = pf->hw.pf_id; in i40e_add_vsi()
13983 dev_info(&pf->pdev->dev, in i40e_add_vsi()
13986 i40e_aq_str(&pf->hw, in i40e_add_vsi()
13987 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
13994 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags) && in i40e_add_vsi()
13995 !(pf->hw.func_caps.iscsi)) { /* NIC type PF */ in i40e_add_vsi()
13997 ctxt.seid = pf->main_vsi_seid; in i40e_add_vsi()
13998 ctxt.pf_num = pf->hw.pf_id; in i40e_add_vsi()
14003 dev_info(&pf->pdev->dev, in i40e_add_vsi()
14006 i40e_aq_str(&pf->hw, in i40e_add_vsi()
14007 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
14018 * For MFP case the iSCSI PF would use this in i40e_add_vsi()
14026 dev_info(&pf->pdev->dev, in i40e_add_vsi()
14030 i40e_aq_str(&pf->hw, in i40e_add_vsi()
14031 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
14042 if (test_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags) && in i40e_add_vsi()
14100 if (pf->vf[vsi->vf_id].spoofchk) { in i40e_add_vsi()
14125 i40e_aq_str(&pf->hw, in i40e_add_vsi()
14126 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
14148 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_add_vsi()
14154 dev_info(&pf->pdev->dev, in i40e_add_vsi()
14157 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_vsi()
14177 struct i40e_pf *pf; in i40e_vsi_release() local
14181 pf = vsi->back; in i40e_vsi_release()
14185 dev_info(&pf->pdev->dev, "VSI %d has existing VEB %d\n", in i40e_vsi_release()
14189 if (vsi->type == I40E_VSI_MAIN && !test_bit(__I40E_DOWN, pf->state)) { in i40e_vsi_release()
14190 dev_info(&pf->pdev->dev, "Can't remove PF VSI\n"); in i40e_vsi_release()
14210 i40e_devlink_destroy_port(pf); in i40e_vsi_release()
14245 veb = i40e_pf_get_veb_by_seid(pf, uplink_seid); in i40e_vsi_release()
14250 i40e_pf_for_each_vsi(pf, i, vsi) in i40e_vsi_release()
14278 struct i40e_pf *pf = vsi->back; in i40e_vsi_setup_vectors() local
14281 dev_info(&pf->pdev->dev, "VSI %d has existing q_vectors\n", in i40e_vsi_setup_vectors()
14287 dev_info(&pf->pdev->dev, "VSI %d has non-zero base vector %d\n", in i40e_vsi_setup_vectors()
14294 dev_info(&pf->pdev->dev, in i40e_vsi_setup_vectors()
14304 if (!test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_vsi_setup_vectors()
14307 vsi->base_vector = i40e_get_lump(pf, pf->irq_pile, in i40e_vsi_setup_vectors()
14310 dev_info(&pf->pdev->dev, in i40e_vsi_setup_vectors()
14335 struct i40e_pf *pf; in i40e_vsi_reinit_setup() local
14341 pf = vsi->back; in i40e_vsi_reinit_setup()
14343 i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx); in i40e_vsi_reinit_setup()
14355 ret = i40e_get_lump(pf, pf->qp_pile, alloc_queue_pairs, vsi->idx); in i40e_vsi_reinit_setup()
14357 dev_info(&pf->pdev->dev, in i40e_vsi_reinit_setup()
14367 main_vsi = i40e_pf_get_main_vsi(pf); in i40e_vsi_reinit_setup()
14368 main_vsi->seid = pf->main_vsi_seid; in i40e_vsi_reinit_setup()
14372 i40e_rm_default_mac_filter(vsi, pf->hw.mac.perm_addr); in i40e_vsi_reinit_setup()
14392 i40e_devlink_destroy_port(pf); in i40e_vsi_reinit_setup()
14393 i40e_aq_delete_element(&pf->hw, vsi->seid, NULL); in i40e_vsi_reinit_setup()
14401 * @pf: board private structure
14412 struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type, in i40e_vsi_setup() argument
14422 * - the PF's port seid in i40e_vsi_setup()
14423 * no VEB is needed because this is the PF in i40e_vsi_setup()
14429 * - seid of the PF VSI, which is what creates the first VEB in i40e_vsi_setup()
14434 veb = i40e_pf_get_veb_by_seid(pf, uplink_seid); in i40e_vsi_setup()
14435 if (!veb && uplink_seid != pf->mac_seid) { in i40e_vsi_setup()
14436 vsi = i40e_pf_get_vsi_by_seid(pf, uplink_seid); in i40e_vsi_setup()
14438 dev_info(&pf->pdev->dev, "no such uplink_seid %d\n", in i40e_vsi_setup()
14443 if (vsi->uplink_seid == pf->mac_seid) in i40e_vsi_setup()
14444 veb = i40e_veb_setup(pf, pf->mac_seid, vsi->seid, in i40e_vsi_setup()
14447 veb = i40e_veb_setup(pf, vsi->uplink_seid, vsi->seid, in i40e_vsi_setup()
14459 if (!test_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags)) { in i40e_vsi_setup()
14461 clear_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_vsi_setup()
14465 veb = i40e_pf_get_veb_by_seid(pf, vsi->uplink_seid); in i40e_vsi_setup()
14467 dev_info(&pf->pdev->dev, "couldn't add VEB\n"); in i40e_vsi_setup()
14476 v_idx = i40e_vsi_mem_alloc(pf, type); in i40e_vsi_setup()
14479 vsi = pf->vsi[v_idx]; in i40e_vsi_setup()
14486 pf->lan_vsi = v_idx; in i40e_vsi_setup()
14493 ret = i40e_get_lump(pf, pf->qp_pile, alloc_queue_pairs, vsi->idx); in i40e_vsi_setup()
14495 dev_info(&pf->pdev->dev, in i40e_vsi_setup()
14519 ret = i40e_devlink_create_port(pf); in i40e_vsi_setup()
14522 SET_NETDEV_DEVLINK_PORT(vsi->netdev, &pf->devlink_port); in i40e_vsi_setup()
14554 if (test_bit(I40E_HW_CAP_RSS_AQ, pf->hw.caps) && in i40e_vsi_setup()
14575 i40e_devlink_destroy_port(pf); in i40e_vsi_setup()
14577 i40e_aq_delete_element(&pf->hw, vsi->seid, NULL); in i40e_vsi_setup()
14594 struct i40e_pf *pf = veb->pf; in i40e_veb_get_bw_info() local
14595 struct i40e_hw *hw = &pf->hw; in i40e_veb_get_bw_info()
14603 dev_info(&pf->pdev->dev, in i40e_veb_get_bw_info()
14606 i40e_aq_str(&pf->hw, hw->aq.asq_last_status)); in i40e_veb_get_bw_info()
14613 dev_info(&pf->pdev->dev, in i40e_veb_get_bw_info()
14616 i40e_aq_str(&pf->hw, hw->aq.asq_last_status)); in i40e_veb_get_bw_info()
14638 * i40e_veb_mem_alloc - Allocates the next available struct veb in the PF
14639 * @pf: board private structure
14642 * On success: returns vsi index in PF (positive)
14644 static int i40e_veb_mem_alloc(struct i40e_pf *pf) in i40e_veb_mem_alloc() argument
14650 /* Need to protect the allocation of switch elements at the PF level */ in i40e_veb_mem_alloc()
14651 mutex_lock(&pf->switch_mutex); in i40e_veb_mem_alloc()
14660 while ((i < I40E_MAX_VEB) && (pf->veb[i] != NULL)) in i40e_veb_mem_alloc()
14672 veb->pf = pf; in i40e_veb_mem_alloc()
14676 pf->veb[i] = veb; in i40e_veb_mem_alloc()
14679 mutex_unlock(&pf->switch_mutex); in i40e_veb_mem_alloc()
14692 struct i40e_pf *pf = branch->pf; in i40e_switch_branch_release() local
14700 i40e_pf_for_each_veb(pf, i, veb) in i40e_switch_branch_release()
14709 i40e_pf_for_each_vsi(pf, i, vsi) in i40e_switch_branch_release()
14719 if (pf->veb[veb_idx]) in i40e_switch_branch_release()
14720 i40e_veb_release(pf->veb[veb_idx]); in i40e_switch_branch_release()
14732 if (veb->pf) { in i40e_veb_clear()
14733 struct i40e_pf *pf = veb->pf; in i40e_veb_clear() local
14735 mutex_lock(&pf->switch_mutex); in i40e_veb_clear()
14736 if (pf->veb[veb->idx] == veb) in i40e_veb_clear()
14737 pf->veb[veb->idx] = NULL; in i40e_veb_clear()
14738 mutex_unlock(&pf->switch_mutex); in i40e_veb_clear()
14751 struct i40e_pf *pf; in i40e_veb_release() local
14754 pf = veb->pf; in i40e_veb_release()
14757 i40e_pf_for_each_vsi(pf, i, vsi_it) in i40e_veb_release()
14768 dev_info(&pf->pdev->dev, in i40e_veb_release()
14781 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_veb_release()
14792 struct i40e_pf *pf = veb->pf; in i40e_add_veb() local
14793 bool enable_stats = !!test_bit(I40E_FLAG_VEB_STATS_ENA, pf->flags); in i40e_add_veb()
14796 ret = i40e_aq_add_veb(&pf->hw, veb->uplink_seid, vsi ? vsi->seid : 0, in i40e_add_veb()
14802 dev_info(&pf->pdev->dev, in i40e_add_veb()
14805 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_veb()
14810 ret = i40e_aq_get_veb_parameters(&pf->hw, veb->seid, NULL, NULL, in i40e_add_veb()
14813 dev_info(&pf->pdev->dev, in i40e_add_veb()
14816 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_veb()
14821 dev_info(&pf->pdev->dev, in i40e_add_veb()
14824 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_veb()
14825 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_add_veb()
14840 * @pf: board private structure
14853 struct i40e_veb *i40e_veb_setup(struct i40e_pf *pf, u16 uplink_seid, in i40e_veb_setup() argument
14864 dev_info(&pf->pdev->dev, in i40e_veb_setup()
14872 vsi = i40e_pf_get_vsi_by_seid(pf, vsi_seid); in i40e_veb_setup()
14874 dev_err(&pf->pdev->dev, "vsi seid %d not found\n", in i40e_veb_setup()
14881 veb_idx = i40e_veb_mem_alloc(pf); in i40e_veb_setup()
14884 veb = pf->veb[veb_idx]; in i40e_veb_setup()
14893 if (vsi && vsi->idx == pf->lan_vsi) in i40e_veb_setup()
14894 pf->lan_veb = veb->idx; in i40e_veb_setup()
14905 * i40e_setup_pf_switch_element - set PF vars based on switch type
14906 * @pf: board private structure
14913 static void i40e_setup_pf_switch_element(struct i40e_pf *pf, in i40e_setup_pf_switch_element() argument
14924 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch_element()
14930 pf->mac_seid = seid; in i40e_setup_pf_switch_element()
14934 if (uplink_seid != pf->mac_seid) in i40e_setup_pf_switch_element()
14936 veb = i40e_pf_get_main_veb(pf); in i40e_setup_pf_switch_element()
14941 veb = i40e_pf_get_veb_by_seid(pf, seid); in i40e_setup_pf_switch_element()
14943 pf->lan_veb = veb->idx; in i40e_setup_pf_switch_element()
14945 v = i40e_veb_mem_alloc(pf); in i40e_setup_pf_switch_element()
14948 pf->lan_veb = v; in i40e_setup_pf_switch_element()
14952 /* Try to get again main VEB as pf->lan_veb may have changed */ in i40e_setup_pf_switch_element()
14953 veb = i40e_pf_get_main_veb(pf); in i40e_setup_pf_switch_element()
14958 veb->uplink_seid = pf->mac_seid; in i40e_setup_pf_switch_element()
14959 veb->pf = pf; in i40e_setup_pf_switch_element()
14965 * the PF's VSI in i40e_setup_pf_switch_element()
14967 pf->mac_seid = uplink_seid; in i40e_setup_pf_switch_element()
14968 pf->main_vsi_seid = seid; in i40e_setup_pf_switch_element()
14970 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch_element()
14972 downlink_seid, pf->main_vsi_seid); in i40e_setup_pf_switch_element()
14983 dev_info(&pf->pdev->dev, "unknown element type=%d seid=%d\n", in i40e_setup_pf_switch_element()
14991 * @pf: board private structure
14997 int i40e_fetch_switch_configuration(struct i40e_pf *pf, bool printconfig) in i40e_fetch_switch_configuration() argument
15013 ret = i40e_aq_get_switch_config(&pf->hw, sw_config, in i40e_fetch_switch_configuration()
15017 dev_info(&pf->pdev->dev, in i40e_fetch_switch_configuration()
15020 i40e_aq_str(&pf->hw, in i40e_fetch_switch_configuration()
15021 pf->hw.aq.asq_last_status)); in i40e_fetch_switch_configuration()
15030 dev_info(&pf->pdev->dev, in i40e_fetch_switch_configuration()
15038 i40e_setup_pf_switch_element(pf, ele, num_reported, in i40e_fetch_switch_configuration()
15049 * @pf: board private structure
15055 static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit, bool lock_acquired) in i40e_setup_pf_switch() argument
15062 ret = i40e_fetch_switch_configuration(pf, false); in i40e_setup_pf_switch()
15064 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch()
15067 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_setup_pf_switch()
15070 i40e_pf_reset_stats(pf); in i40e_setup_pf_switch()
15078 if ((pf->hw.pf_id == 0) && in i40e_setup_pf_switch()
15079 !test_bit(I40E_FLAG_TRUE_PROMISC_ENA, pf->flags)) { in i40e_setup_pf_switch()
15081 pf->last_sw_conf_flags = flags; in i40e_setup_pf_switch()
15084 if (pf->hw.pf_id == 0) { in i40e_setup_pf_switch()
15088 ret = i40e_aq_set_switch_config(&pf->hw, flags, valid_flags, 0, in i40e_setup_pf_switch()
15090 if (ret && pf->hw.aq.asq_last_status != I40E_AQ_RC_ESRCH) { in i40e_setup_pf_switch()
15091 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch()
15094 i40e_aq_str(&pf->hw, in i40e_setup_pf_switch()
15095 pf->hw.aq.asq_last_status)); in i40e_setup_pf_switch()
15098 pf->last_sw_conf_valid_flags = valid_flags; in i40e_setup_pf_switch()
15102 main_vsi = i40e_pf_get_main_vsi(pf); in i40e_setup_pf_switch()
15107 /* Set up the PF VSI associated with the PF's main VSI in i40e_setup_pf_switch()
15110 veb = i40e_pf_get_main_veb(pf); in i40e_setup_pf_switch()
15114 uplink_seid = pf->mac_seid; in i40e_setup_pf_switch()
15116 main_vsi = i40e_vsi_setup(pf, I40E_VSI_MAIN, in i40e_setup_pf_switch()
15121 dev_info(&pf->pdev->dev, "setup of MAIN VSI failed\n"); in i40e_setup_pf_switch()
15122 i40e_cloud_filter_exit(pf); in i40e_setup_pf_switch()
15123 i40e_fdir_teardown(pf); in i40e_setup_pf_switch()
15128 main_vsi->seid = pf->main_vsi_seid; in i40e_setup_pf_switch()
15133 i40e_fdir_sb_setup(pf); in i40e_setup_pf_switch()
15135 /* Setup static PF queue filter control settings */ in i40e_setup_pf_switch()
15136 ret = i40e_setup_pf_filter_control(pf); in i40e_setup_pf_switch()
15138 dev_info(&pf->pdev->dev, "setup_pf_filter_control failed: %d\n", in i40e_setup_pf_switch()
15146 if (test_bit(I40E_FLAG_RSS_ENA, pf->flags)) in i40e_setup_pf_switch()
15147 i40e_pf_config_rss(pf); in i40e_setup_pf_switch()
15150 i40e_link_event(pf); in i40e_setup_pf_switch()
15152 i40e_ptp_init(pf); in i40e_setup_pf_switch()
15168 * @pf: board private structure
15170 static void i40e_determine_queue_usage(struct i40e_pf *pf) in i40e_determine_queue_usage() argument
15175 pf->num_lan_qps = 0; in i40e_determine_queue_usage()
15181 queues_left = pf->hw.func_caps.num_tx_qp; in i40e_determine_queue_usage()
15184 !test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_determine_queue_usage()
15185 /* one qp for PF, no queues for anything else */ in i40e_determine_queue_usage()
15187 pf->alloc_rss_size = pf->num_lan_qps = 1; in i40e_determine_queue_usage()
15190 clear_bit(I40E_FLAG_RSS_ENA, pf->flags); in i40e_determine_queue_usage()
15191 clear_bit(I40E_FLAG_IWARP_ENA, pf->flags); in i40e_determine_queue_usage()
15192 clear_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_determine_queue_usage()
15193 clear_bit(I40E_FLAG_FD_ATR_ENA, pf->flags); in i40e_determine_queue_usage()
15194 clear_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_determine_queue_usage()
15195 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_determine_queue_usage()
15196 clear_bit(I40E_FLAG_SRIOV_ENA, pf->flags); in i40e_determine_queue_usage()
15197 clear_bit(I40E_FLAG_VMDQ_ENA, pf->flags); in i40e_determine_queue_usage()
15198 set_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_determine_queue_usage()
15199 } else if (!test_bit(I40E_FLAG_RSS_ENA, pf->flags) && in i40e_determine_queue_usage()
15200 !test_bit(I40E_FLAG_FD_SB_ENA, pf->flags) && in i40e_determine_queue_usage()
15201 !test_bit(I40E_FLAG_FD_ATR_ENA, pf->flags) && in i40e_determine_queue_usage()
15202 !test_bit(I40E_FLAG_DCB_CAPABLE, pf->flags)) { in i40e_determine_queue_usage()
15203 /* one qp for PF */ in i40e_determine_queue_usage()
15204 pf->alloc_rss_size = pf->num_lan_qps = 1; in i40e_determine_queue_usage()
15205 queues_left -= pf->num_lan_qps; in i40e_determine_queue_usage()
15207 clear_bit(I40E_FLAG_RSS_ENA, pf->flags); in i40e_determine_queue_usage()
15208 clear_bit(I40E_FLAG_IWARP_ENA, pf->flags); in i40e_determine_queue_usage()
15209 clear_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_determine_queue_usage()
15210 clear_bit(I40E_FLAG_FD_ATR_ENA, pf->flags); in i40e_determine_queue_usage()
15211 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_determine_queue_usage()
15212 clear_bit(I40E_FLAG_VMDQ_ENA, pf->flags); in i40e_determine_queue_usage()
15213 set_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_determine_queue_usage()
15216 if (test_bit(I40E_FLAG_DCB_CAPABLE, pf->flags) && in i40e_determine_queue_usage()
15218 clear_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_determine_queue_usage()
15219 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_determine_queue_usage()
15220 dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); in i40e_determine_queue_usage()
15224 q_max = max_t(int, pf->rss_size_max, num_online_cpus()); in i40e_determine_queue_usage()
15225 q_max = min_t(int, q_max, pf->hw.func_caps.num_tx_qp); in i40e_determine_queue_usage()
15226 q_max = min_t(int, q_max, pf->hw.func_caps.num_msix_vectors); in i40e_determine_queue_usage()
15227 pf->num_lan_qps = q_max; in i40e_determine_queue_usage()
15229 queues_left -= pf->num_lan_qps; in i40e_determine_queue_usage()
15232 if (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags)) { in i40e_determine_queue_usage()
15236 clear_bit(I40E_FLAG_FD_SB_ENA, pf->flags); in i40e_determine_queue_usage()
15237 set_bit(I40E_FLAG_FD_SB_INACTIVE, pf->flags); in i40e_determine_queue_usage()
15238 …dev_info(&pf->pdev->dev, "not enough queues for Flow Director. Flow Director feature is disabled\n… in i40e_determine_queue_usage()
15242 if (test_bit(I40E_FLAG_SRIOV_ENA, pf->flags) && in i40e_determine_queue_usage()
15243 pf->num_vf_qps && pf->num_req_vfs && queues_left) { in i40e_determine_queue_usage()
15244 pf->num_req_vfs = min_t(int, pf->num_req_vfs, in i40e_determine_queue_usage()
15245 (queues_left / pf->num_vf_qps)); in i40e_determine_queue_usage()
15246 queues_left -= (pf->num_req_vfs * pf->num_vf_qps); in i40e_determine_queue_usage()
15249 if (test_bit(I40E_FLAG_VMDQ_ENA, pf->flags) && in i40e_determine_queue_usage()
15250 pf->num_vmdq_vsis && pf->num_vmdq_qps && queues_left) { in i40e_determine_queue_usage()
15251 pf->num_vmdq_vsis = min_t(int, pf->num_vmdq_vsis, in i40e_determine_queue_usage()
15252 (queues_left / pf->num_vmdq_qps)); in i40e_determine_queue_usage()
15253 queues_left -= (pf->num_vmdq_vsis * pf->num_vmdq_qps); in i40e_determine_queue_usage()
15256 pf->queues_left = queues_left; in i40e_determine_queue_usage()
15257 dev_dbg(&pf->pdev->dev, in i40e_determine_queue_usage()
15259 pf->hw.func_caps.num_tx_qp, in i40e_determine_queue_usage()
15260 !!test_bit(I40E_FLAG_FD_SB_ENA, pf->flags), in i40e_determine_queue_usage()
15261 pf->num_lan_qps, pf->alloc_rss_size, pf->num_req_vfs, in i40e_determine_queue_usage()
15262 pf->num_vf_qps, pf->num_vmdq_vsis, pf->num_vmdq_qps, in i40e_determine_queue_usage()
15267 * i40e_setup_pf_filter_control - Setup PF static filter control
15268 * @pf: PF to be setup
15270 * i40e_setup_pf_filter_control sets up a PF's initial filter control
15271 * settings. If PE/FCoE are enabled then it will also set the per PF
15273 * ethertype and macvlan type filter settings for the pf.
15277 static int i40e_setup_pf_filter_control(struct i40e_pf *pf) in i40e_setup_pf_filter_control() argument
15279 struct i40e_filter_control_settings *settings = &pf->filter_settings; in i40e_setup_pf_filter_control()
15284 if (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags) || in i40e_setup_pf_filter_control()
15285 test_bit(I40E_FLAG_FD_ATR_ENA, pf->flags)) in i40e_setup_pf_filter_control()
15288 /* Ethtype and MACVLAN filters enabled for PF */ in i40e_setup_pf_filter_control()
15292 if (i40e_set_filter_control(&pf->hw, settings)) in i40e_setup_pf_filter_control()
15300 static void i40e_print_features(struct i40e_pf *pf) in i40e_print_features() argument
15302 struct i40e_vsi *main_vsi = i40e_pf_get_main_vsi(pf); in i40e_print_features()
15303 struct i40e_hw *hw = &pf->hw; in i40e_print_features()
15311 i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", hw->pf_id); in i40e_print_features()
15313 i += scnprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs); in i40e_print_features()
15316 pf->hw.func_caps.num_vsis, main_vsi->num_queue_pairs); in i40e_print_features()
15317 if (test_bit(I40E_FLAG_RSS_ENA, pf->flags)) in i40e_print_features()
15319 if (test_bit(I40E_FLAG_FD_ATR_ENA, pf->flags)) in i40e_print_features()
15321 if (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags)) { in i40e_print_features()
15325 if (test_bit(I40E_FLAG_DCB_CAPABLE, pf->flags)) in i40e_print_features()
15329 if (test_bit(I40E_FLAG_PTP_ENA, pf->flags)) in i40e_print_features()
15331 if (test_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags)) in i40e_print_features()
15336 dev_info(&pf->pdev->dev, "%s\n", buf); in i40e_print_features()
15344 * @pf: board private structure
15351 static void i40e_get_platform_mac_addr(struct pci_dev *pdev, struct i40e_pf *pf) in i40e_get_platform_mac_addr() argument
15353 if (eth_platform_get_mac_address(&pdev->dev, pf->hw.mac.addr)) in i40e_get_platform_mac_addr()
15354 i40e_get_mac_addr(&pf->hw, pf->hw.mac.addr); in i40e_get_platform_mac_addr()
15386 * @pf: board private structure
15393 static bool i40e_check_recovery_mode(struct i40e_pf *pf) in i40e_check_recovery_mode() argument
15395 u32 val = rd32(&pf->hw, I40E_GL_FWSTS); in i40e_check_recovery_mode()
15398 dev_crit(&pf->pdev->dev, "Firmware recovery mode detected. Limiting functionality.\n"); in i40e_check_recovery_mode()
15399 …dev_crit(&pf->pdev->dev, "Refer to the Intel(R) Ethernet Adapters and Devices User Guide for detai… in i40e_check_recovery_mode()
15400 set_bit(__I40E_RECOVERY_MODE, pf->state); in i40e_check_recovery_mode()
15404 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_check_recovery_mode()
15405 …dev_info(&pf->pdev->dev, "Please do Power-On Reset to initialize adapter in normal mode with full … in i40e_check_recovery_mode()
15412 * @pf: board private structure
15421 * state is to issue a series of pf-resets and check a return value.
15422 * If a PF reset returns success then the firmware could be in recovery
15431 static int i40e_pf_loop_reset(struct i40e_pf *pf) in i40e_pf_loop_reset() argument
15433 /* wait max 10 seconds for PF reset to succeed */ in i40e_pf_loop_reset()
15435 struct i40e_hw *hw = &pf->hw; in i40e_pf_loop_reset()
15445 pf->pfr_count++; in i40e_pf_loop_reset()
15447 dev_info(&pf->pdev->dev, "PF reset failed: %d\n", ret); in i40e_pf_loop_reset()
15454 * @pf: board private structure
15463 static bool i40e_check_fw_empr(struct i40e_pf *pf) in i40e_check_fw_empr() argument
15465 const u32 fw_sts = rd32(&pf->hw, I40E_GL_FWSTS) & in i40e_check_fw_empr()
15472 * i40e_handle_resets - handle EMP resets and PF resets
15473 * @pf: board private structure
15475 * Handle both EMP resets and PF resets and conclude whether there are
15482 static int i40e_handle_resets(struct i40e_pf *pf) in i40e_handle_resets() argument
15484 const int pfr = i40e_pf_loop_reset(pf); in i40e_handle_resets()
15485 const bool is_empr = i40e_check_fw_empr(pf); in i40e_handle_resets()
15488 …dev_crit(&pf->pdev->dev, "Entering recovery mode due to repeated FW resets. This may take several … in i40e_handle_resets()
15495 * @pf: board private structure
15503 static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw) in i40e_init_recovery_mode() argument
15509 pci_set_drvdata(pf->pdev, pf); in i40e_init_recovery_mode()
15510 pci_save_state(pf->pdev); in i40e_init_recovery_mode()
15513 timer_setup(&pf->service_timer, i40e_service_timer, 0); in i40e_init_recovery_mode()
15514 pf->service_timer_period = HZ; in i40e_init_recovery_mode()
15516 INIT_WORK(&pf->service_task, i40e_service_task); in i40e_init_recovery_mode()
15517 clear_bit(__I40E_SERVICE_SCHED, pf->state); in i40e_init_recovery_mode()
15519 err = i40e_init_interrupt_scheme(pf); in i40e_init_recovery_mode()
15528 if (pf->hw.func_caps.num_vsis < I40E_MIN_VSI_ALLOC) in i40e_init_recovery_mode()
15529 pf->num_alloc_vsi = I40E_MIN_VSI_ALLOC; in i40e_init_recovery_mode()
15531 pf->num_alloc_vsi = pf->hw.func_caps.num_vsis; in i40e_init_recovery_mode()
15533 /* Set up the vsi struct and our local tracking of the MAIN PF vsi. */ in i40e_init_recovery_mode()
15534 pf->vsi = kcalloc(pf->num_alloc_vsi, sizeof(struct i40e_vsi *), in i40e_init_recovery_mode()
15536 if (!pf->vsi) { in i40e_init_recovery_mode()
15544 v_idx = i40e_vsi_mem_alloc(pf, I40E_VSI_MAIN); in i40e_init_recovery_mode()
15549 pf->lan_vsi = v_idx; in i40e_init_recovery_mode()
15550 vsi = pf->vsi[v_idx]; in i40e_init_recovery_mode()
15563 i40e_dbg_pf_init(pf); in i40e_init_recovery_mode()
15565 err = i40e_setup_misc_vector_for_recovery_mode(pf); in i40e_init_recovery_mode()
15570 i40e_send_version(pf); in i40e_init_recovery_mode()
15573 mod_timer(&pf->service_timer, in i40e_init_recovery_mode()
15574 round_jiffies(jiffies + pf->service_timer_period)); in i40e_init_recovery_mode()
15579 i40e_reset_interrupt_capability(pf); in i40e_init_recovery_mode()
15580 timer_shutdown_sync(&pf->service_timer); in i40e_init_recovery_mode()
15583 pci_release_mem_regions(pf->pdev); in i40e_init_recovery_mode()
15584 pci_disable_device(pf->pdev); in i40e_init_recovery_mode()
15585 i40e_free_pf(pf); in i40e_init_recovery_mode()
15599 struct i40e_pf *pf = i40e_hw_to_pf(hw); in i40e_set_subsystem_device_id() local
15601 hw->subsystem_device_id = pf->pdev->subsystem_device ? in i40e_set_subsystem_device_id()
15602 pf->pdev->subsystem_device : in i40e_set_subsystem_device_id()
15611 * i40e_probe initializes a PF identified by a pci_dev structure.
15612 * The OS initialization, configuring of the PF private structure,
15624 struct i40e_pf *pf; in i40e_probe() local
15662 pf = i40e_alloc_pf(&pdev->dev); in i40e_probe()
15663 if (!pf) { in i40e_probe()
15667 pf->next_vsi = 0; in i40e_probe()
15668 pf->pdev = pdev; in i40e_probe()
15669 set_bit(__I40E_DOWN, pf->state); in i40e_probe()
15671 hw = &pf->hw; in i40e_probe()
15673 pf->ioremap_len = min_t(int, pci_resource_len(pdev, 0), in i40e_probe()
15680 if (pf->ioremap_len < I40E_GLGEN_STAT_CLEAR) { in i40e_probe()
15682 pf->ioremap_len); in i40e_probe()
15686 hw->hw_addr = ioremap(pci_resource_start(pdev, 0), pf->ioremap_len); in i40e_probe()
15691 pf->ioremap_len, err); in i40e_probe()
15710 INIT_LIST_HEAD(&pf->l3_flex_pit_list); in i40e_probe()
15711 INIT_LIST_HEAD(&pf->l4_flex_pit_list); in i40e_probe()
15712 INIT_LIST_HEAD(&pf->ddp_old_prof); in i40e_probe()
15720 pf->msg_enable = netif_msg_init(debug, in i40e_probe()
15725 pf->hw.debug_mask = debug; in i40e_probe()
15733 pf->corer_count++; in i40e_probe()
15738 /* Reset here to make sure all is clean and to define PF 'n' */ in i40e_probe()
15748 err = i40e_handle_resets(pf); in i40e_probe()
15752 i40e_check_recovery_mode(pf); in i40e_probe()
15764 snprintf(pf->int_name, sizeof(pf->int_name) - 1, in i40e_probe()
15766 dev_driver_string(&pf->pdev->dev), dev_name(&pdev->dev)); in i40e_probe()
15776 pf->hw.fc.requested_mode = I40E_FC_NONE; in i40e_probe()
15820 i40e_verify_eeprom(pf); in i40e_probe()
15828 err = i40e_get_capabilities(pf, i40e_aqc_opc_list_func_capabilities); in i40e_probe()
15832 err = i40e_sw_init(pf); in i40e_probe()
15838 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_probe()
15839 return i40e_init_recovery_mode(pf, hw); in i40e_probe()
15859 if (test_bit(I40E_HW_CAP_STOP_FW_LLDP, pf->hw.caps)) { in i40e_probe()
15865 i40e_get_platform_mac_addr(pdev, pf); in i40e_probe()
15876 set_bit(I40E_HW_CAP_PORT_ID_VALID, pf->hw.caps); in i40e_probe()
15878 i40e_ptp_alloc_pins(pf); in i40e_probe()
15879 pci_set_drvdata(pdev, pf); in i40e_probe()
15883 status = i40e_get_fw_lldp_status(&pf->hw, &lldp_status); in i40e_probe()
15886 (clear_bit(I40E_FLAG_FW_LLDP_DIS, pf->flags)) : in i40e_probe()
15887 (set_bit(I40E_FLAG_FW_LLDP_DIS, pf->flags)); in i40e_probe()
15889 test_bit(I40E_FLAG_FW_LLDP_DIS, pf->flags) ? in i40e_probe()
15896 err = i40e_init_pf_dcb(pf); in i40e_probe()
15899 clear_bit(I40E_FLAG_DCB_CAPABLE, pf->flags); in i40e_probe()
15900 clear_bit(I40E_FLAG_DCB_ENA, pf->flags); in i40e_probe()
15906 timer_setup(&pf->service_timer, i40e_service_timer, 0); in i40e_probe()
15907 pf->service_timer_period = HZ; in i40e_probe()
15909 INIT_WORK(&pf->service_task, i40e_service_task); in i40e_probe()
15910 clear_bit(__I40E_SERVICE_SCHED, pf->state); in i40e_probe()
15915 pf->wol_en = false; in i40e_probe()
15917 pf->wol_en = true; in i40e_probe()
15918 device_set_wakeup_enable(&pf->pdev->dev, pf->wol_en); in i40e_probe()
15921 i40e_determine_queue_usage(pf); in i40e_probe()
15922 err = i40e_init_interrupt_scheme(pf); in i40e_probe()
15928 * pairs than MSI-X vectors (pf->num_lan_msix) exist. Thus in i40e_probe()
15929 * vsi->num_queue_pairs will be equal to pf->num_lan_msix, i.e., 1. in i40e_probe()
15932 pf->num_lan_msix = 1; in i40e_probe()
15934 pf->udp_tunnel_nic.set_port = i40e_udp_tunnel_set_port; in i40e_probe()
15935 pf->udp_tunnel_nic.unset_port = i40e_udp_tunnel_unset_port; in i40e_probe()
15936 pf->udp_tunnel_nic.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP; in i40e_probe()
15937 pf->udp_tunnel_nic.shared = &pf->udp_tunnel_shared; in i40e_probe()
15938 pf->udp_tunnel_nic.tables[0].n_entries = I40E_MAX_PF_UDP_OFFLOAD_PORTS; in i40e_probe()
15939 pf->udp_tunnel_nic.tables[0].tunnel_types = UDP_TUNNEL_TYPE_VXLAN | in i40e_probe()
15947 if (pf->hw.func_caps.num_vsis < I40E_MIN_VSI_ALLOC) in i40e_probe()
15948 pf->num_alloc_vsi = I40E_MIN_VSI_ALLOC; in i40e_probe()
15950 pf->num_alloc_vsi = pf->hw.func_caps.num_vsis; in i40e_probe()
15951 if (pf->num_alloc_vsi > UDP_TUNNEL_NIC_MAX_SHARING_DEVICES) { in i40e_probe()
15952 dev_warn(&pf->pdev->dev, in i40e_probe()
15954 pf->num_alloc_vsi, UDP_TUNNEL_NIC_MAX_SHARING_DEVICES); in i40e_probe()
15955 pf->num_alloc_vsi = UDP_TUNNEL_NIC_MAX_SHARING_DEVICES; in i40e_probe()
15958 /* Set up the *vsi struct and our local tracking of the MAIN PF vsi. */ in i40e_probe()
15959 pf->vsi = kcalloc(pf->num_alloc_vsi, sizeof(struct i40e_vsi *), in i40e_probe()
15961 if (!pf->vsi) { in i40e_probe()
15968 if (test_bit(I40E_FLAG_SRIOV_ENA, pf->flags) && in i40e_probe()
15969 test_bit(I40E_FLAG_MSIX_ENA, pf->flags) && in i40e_probe()
15970 !test_bit(__I40E_BAD_EEPROM, pf->state)) { in i40e_probe()
15972 set_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_probe()
15975 err = i40e_setup_pf_switch(pf, false, false); in i40e_probe()
15981 vsi = i40e_pf_get_main_vsi(pf); in i40e_probe()
15985 vsi = i40e_find_vsi_by_type(pf, I40E_VSI_FDIR); in i40e_probe()
15992 err = i40e_aq_set_phy_int_mask(&pf->hw, in i40e_probe()
15997 dev_info(&pf->pdev->dev, "set phy mask fail, err %pe aq_err %s\n", in i40e_probe()
15999 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_probe()
16012 if (test_bit(I40E_HW_CAP_RESTART_AUTONEG, pf->hw.caps)) { in i40e_probe()
16014 err = i40e_aq_set_link_restart_an(&pf->hw, true, NULL); in i40e_probe()
16016 dev_info(&pf->pdev->dev, "link restart failed, err %pe aq_err %s\n", in i40e_probe()
16018 i40e_aq_str(&pf->hw, in i40e_probe()
16019 pf->hw.aq.asq_last_status)); in i40e_probe()
16025 clear_bit(__I40E_DOWN, pf->state); in i40e_probe()
16032 if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) { in i40e_probe()
16033 err = i40e_setup_misc_vector(pf); in i40e_probe()
16037 i40e_cloud_filter_exit(pf); in i40e_probe()
16038 i40e_fdir_teardown(pf); in i40e_probe()
16045 if (test_bit(I40E_FLAG_SRIOV_ENA, pf->flags) && in i40e_probe()
16046 test_bit(I40E_FLAG_MSIX_ENA, pf->flags) && in i40e_probe()
16047 !test_bit(__I40E_BAD_EEPROM, pf->state)) { in i40e_probe()
16057 err = i40e_alloc_vfs(pf, pci_num_vf(pdev)); in i40e_probe()
16066 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags)) { in i40e_probe()
16067 pf->iwarp_base_vector = i40e_get_lump(pf, pf->irq_pile, in i40e_probe()
16068 pf->num_iwarp_msix, in i40e_probe()
16070 if (pf->iwarp_base_vector < 0) { in i40e_probe()
16073 pf->num_iwarp_msix, pf->iwarp_base_vector); in i40e_probe()
16074 clear_bit(I40E_FLAG_IWARP_ENA, pf->flags); in i40e_probe()
16078 i40e_dbg_pf_init(pf); in i40e_probe()
16081 i40e_send_version(pf); in i40e_probe()
16084 mod_timer(&pf->service_timer, in i40e_probe()
16085 round_jiffies(jiffies + pf->service_timer_period)); in i40e_probe()
16087 /* add this PF to client device list and launch a client service task */ in i40e_probe()
16088 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags)) { in i40e_probe()
16089 err = i40e_lan_add_device(pf); in i40e_probe()
16091 dev_info(&pdev->dev, "Failed to add PF to client API service list: %d\n", in i40e_probe()
16101 if (!test_bit(I40E_HW_CAP_NO_PCI_LINK_CHECK, pf->hw.caps)) { in i40e_probe()
16108 pcie_capability_read_word(pf->pdev, PCI_EXP_LNKSTA, in i40e_probe()
16149 dev_dbg(&pf->pdev->dev, "get requested speeds ret = %pe last_status = %s\n", in i40e_probe()
16151 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_probe()
16152 pf->hw.phy.link_info.requested_speeds = abilities.link_speed; in i40e_probe()
16155 i40e_set_fec_in_flags(abilities.fec_cfg_curr_mod_ext_info, pf->flags); in i40e_probe()
16160 dev_dbg(&pf->pdev->dev, "get supported phy types ret = %pe last_status = %s\n", in i40e_probe()
16162 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_probe()
16167 rd32(&pf->hw, I40E_PRTGL_SAH)); in i40e_probe()
16170 pf->hw.port, val, MAX_FRAME_SIZE_DEFAULT); in i40e_probe()
16175 * PF/VF VSIs. in i40e_probe()
16178 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, in i40e_probe()
16179 pf->main_vsi_seid); in i40e_probe()
16181 if ((pf->hw.device_id == I40E_DEV_ID_10G_BASE_T) || in i40e_probe()
16182 (pf->hw.device_id == I40E_DEV_ID_10G_BASE_T4)) in i40e_probe()
16183 set_bit(I40E_HW_CAP_PHY_CONTROLS_LEDS, pf->hw.caps); in i40e_probe()
16184 if (pf->hw.device_id == I40E_DEV_ID_SFP_I_X722) in i40e_probe()
16185 set_bit(I40E_HW_CAP_CRT_RETIMER, pf->hw.caps); in i40e_probe()
16187 i40e_print_features(pf); in i40e_probe()
16189 i40e_devlink_register(pf); in i40e_probe()
16195 set_bit(__I40E_DOWN, pf->state); in i40e_probe()
16196 i40e_clear_interrupt_scheme(pf); in i40e_probe()
16197 kfree(pf->vsi); in i40e_probe()
16199 i40e_reset_interrupt_capability(pf); in i40e_probe()
16200 timer_shutdown_sync(&pf->service_timer); in i40e_probe()
16205 kfree(pf->qp_pile); in i40e_probe()
16211 i40e_free_pf(pf); in i40e_probe()
16231 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_remove() local
16232 struct i40e_hw *hw = &pf->hw; in i40e_remove()
16238 i40e_devlink_unregister(pf); in i40e_remove()
16240 i40e_dbg_pf_exit(pf); in i40e_remove()
16242 i40e_ptp_stop(pf); in i40e_remove()
16252 while (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_remove()
16254 set_bit(__I40E_IN_REMOVE, pf->state); in i40e_remove()
16256 if (test_bit(I40E_FLAG_SRIOV_ENA, pf->flags)) { in i40e_remove()
16257 set_bit(__I40E_VF_RESETS_DISABLED, pf->state); in i40e_remove()
16258 i40e_free_vfs(pf); in i40e_remove()
16259 clear_bit(I40E_FLAG_SRIOV_ENA, pf->flags); in i40e_remove()
16262 set_bit(__I40E_SUSPENDED, pf->state); in i40e_remove()
16263 set_bit(__I40E_DOWN, pf->state); in i40e_remove()
16264 if (pf->service_timer.function) in i40e_remove()
16265 timer_shutdown_sync(&pf->service_timer); in i40e_remove()
16266 if (pf->service_task.func) in i40e_remove()
16267 cancel_work_sync(&pf->service_task); in i40e_remove()
16269 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_remove()
16270 struct i40e_vsi *vsi = pf->vsi[0]; in i40e_remove()
16272 /* We know that we have allocated only one vsi for this PF, in i40e_remove()
16285 i40e_notify_client_of_netdev_close(pf, false); in i40e_remove()
16287 i40e_fdir_teardown(pf); in i40e_remove()
16290 * This will leave only the PF's VSI remaining. in i40e_remove()
16292 i40e_pf_for_each_veb(pf, i, veb) in i40e_remove()
16293 if (veb->uplink_seid == pf->mac_seid || in i40e_remove()
16297 /* Now we can shutdown the PF's VSIs, just before we kill in i40e_remove()
16300 i40e_pf_for_each_vsi(pf, i, vsi) { in i40e_remove()
16303 pf->vsi[i] = NULL; in i40e_remove()
16306 i40e_cloud_filter_exit(pf); in i40e_remove()
16309 if (test_bit(I40E_FLAG_IWARP_ENA, pf->flags)) { in i40e_remove()
16310 ret_code = i40e_lan_del_device(pf); in i40e_remove()
16327 if (test_bit(__I40E_RECOVERY_MODE, pf->state) && in i40e_remove()
16328 !test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_remove()
16329 free_irq(pf->pdev->irq, pf); in i40e_remove()
16340 i40e_clear_interrupt_scheme(pf); in i40e_remove()
16341 i40e_pf_for_each_vsi(pf, i, vsi) { in i40e_remove()
16342 if (!test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_remove()
16346 pf->vsi[i] = NULL; in i40e_remove()
16350 i40e_pf_for_each_veb(pf, i, veb) { in i40e_remove()
16352 pf->veb[i] = NULL; in i40e_remove()
16355 kfree(pf->qp_pile); in i40e_remove()
16356 kfree(pf->vsi); in i40e_remove()
16359 i40e_free_pf(pf); in i40e_remove()
16368 * @pf: pointer to i40e_pf struct
16370 static void i40e_enable_mc_magic_wake(struct i40e_pf *pf) in i40e_enable_mc_magic_wake() argument
16372 struct i40e_vsi *main_vsi = i40e_pf_get_main_vsi(pf); in i40e_enable_mc_magic_wake()
16373 struct i40e_hw *hw = &pf->hw; in i40e_enable_mc_magic_wake()
16382 dev_err(&pf->pdev->dev, in i40e_enable_mc_magic_wake()
16398 dev_err(&pf->pdev->dev, in i40e_enable_mc_magic_wake()
16408 dev_err(&pf->pdev->dev, in i40e_enable_mc_magic_wake()
16414 * @pf: pointer to i40e_pf struct
16417 static int i40e_io_suspend(struct i40e_pf *pf) in i40e_io_suspend() argument
16419 struct i40e_hw *hw = &pf->hw; in i40e_io_suspend()
16421 set_bit(__I40E_DOWN, pf->state); in i40e_io_suspend()
16424 del_timer_sync(&pf->service_timer); in i40e_io_suspend()
16425 cancel_work_sync(&pf->service_task); in i40e_io_suspend()
16430 i40e_notify_client_of_netdev_close(pf, false); in i40e_io_suspend()
16432 if (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) && in i40e_io_suspend()
16433 pf->wol_en) in i40e_io_suspend()
16434 i40e_enable_mc_magic_wake(pf); in i40e_io_suspend()
16442 i40e_prep_for_reset(pf); in i40e_io_suspend()
16444 wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); in i40e_io_suspend()
16445 wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); in i40e_io_suspend()
16452 i40e_clear_interrupt_scheme(pf); in i40e_io_suspend()
16461 * @pf: pointer to i40e_pf struct
16464 static int i40e_io_resume(struct i40e_pf *pf) in i40e_io_resume() argument
16466 struct device *dev = &pf->pdev->dev; in i40e_io_resume()
16477 err = i40e_restore_interrupt_scheme(pf); in i40e_io_resume()
16483 clear_bit(__I40E_DOWN, pf->state); in i40e_io_resume()
16484 i40e_reset_and_rebuild(pf, false, true); in i40e_io_resume()
16489 clear_bit(__I40E_SUSPENDED, pf->state); in i40e_io_resume()
16492 mod_timer(&pf->service_timer, in i40e_io_resume()
16493 round_jiffies(jiffies + pf->service_timer_period)); in i40e_io_resume()
16510 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_detected() local
16514 if (!pf) { in i40e_pci_error_detected()
16521 if (!test_bit(__I40E_SUSPENDED, pf->state)) in i40e_pci_error_detected()
16522 i40e_io_suspend(pf); in i40e_pci_error_detected()
16539 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_slot_reset() local
16555 reg = rd32(&pf->hw, I40E_GLGEN_RTRIG); in i40e_pci_error_slot_reset()
16571 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_reset_prepare() local
16573 i40e_prep_for_reset(pf); in i40e_pci_error_reset_prepare()
16582 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_reset_done() local
16584 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_pci_error_reset_done()
16587 i40e_reset_and_rebuild(pf, false, false); in i40e_pci_error_reset_done()
16602 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_resume() local
16605 if (test_bit(__I40E_SUSPENDED, pf->state)) in i40e_pci_error_resume()
16608 i40e_io_resume(pf); in i40e_pci_error_resume()
16617 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_shutdown() local
16618 struct i40e_hw *hw = &pf->hw; in i40e_shutdown()
16620 set_bit(__I40E_SUSPENDED, pf->state); in i40e_shutdown()
16621 set_bit(__I40E_DOWN, pf->state); in i40e_shutdown()
16623 del_timer_sync(&pf->service_timer); in i40e_shutdown()
16624 cancel_work_sync(&pf->service_task); in i40e_shutdown()
16625 i40e_cloud_filter_exit(pf); in i40e_shutdown()
16626 i40e_fdir_teardown(pf); in i40e_shutdown()
16631 i40e_notify_client_of_netdev_close(pf, false); in i40e_shutdown()
16633 if (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) && in i40e_shutdown()
16634 pf->wol_en) in i40e_shutdown()
16635 i40e_enable_mc_magic_wake(pf); in i40e_shutdown()
16637 i40e_prep_for_reset(pf); in i40e_shutdown()
16640 (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); in i40e_shutdown()
16642 (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); in i40e_shutdown()
16645 if (test_bit(__I40E_RECOVERY_MODE, pf->state) && in i40e_shutdown()
16646 !test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) in i40e_shutdown()
16647 free_irq(pf->pdev->irq, pf); in i40e_shutdown()
16654 i40e_clear_interrupt_scheme(pf); in i40e_shutdown()
16658 pci_wake_from_d3(pdev, pf->wol_en); in i40e_shutdown()
16669 struct i40e_pf *pf = dev_get_drvdata(dev); in i40e_suspend() local
16672 if (test_and_set_bit(__I40E_SUSPENDED, pf->state)) in i40e_suspend()
16674 return i40e_io_suspend(pf); in i40e_suspend()
16683 struct i40e_pf *pf = dev_get_drvdata(dev); in i40e_resume() local
16686 if (!test_bit(__I40E_SUSPENDED, pf->state)) in i40e_resume()
16688 return i40e_io_resume(pf); in i40e_resume()