Lines Matching refs:pf
32 static void i40e_handle_reset_warning(struct i40e_pf *pf, bool lock_acquired);
35 static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit, bool lock_acquired);
36 static int i40e_setup_misc_vector(struct i40e_pf *pf);
37 static void i40e_determine_queue_usage(struct i40e_pf *pf);
38 static int i40e_setup_pf_filter_control(struct i40e_pf *pf);
39 static void i40e_prep_for_reset(struct i40e_pf *pf);
40 static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit,
42 static int i40e_reset(struct i40e_pf *pf);
43 static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired);
44 static int i40e_setup_misc_vector_for_recovery_mode(struct i40e_pf *pf);
45 static int i40e_restore_interrupt_scheme(struct i40e_pf *pf);
46 static bool i40e_check_recovery_mode(struct i40e_pf *pf);
47 static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw);
48 static void i40e_fdir_sb_setup(struct i40e_pf *pf);
50 static int i40e_get_capabilities(struct i40e_pf *pf,
52 static bool i40e_is_total_port_shutdown_enabled(struct i40e_pf *pf);
138 struct i40e_pf *pf = (struct i40e_pf *)hw->back; in i40e_allocate_dma_mem_d() local
141 mem->va = dma_alloc_coherent(&pf->pdev->dev, mem->size, &mem->pa, in i40e_allocate_dma_mem_d()
156 struct i40e_pf *pf = (struct i40e_pf *)hw->back; in i40e_free_dma_mem_d() local
158 dma_free_coherent(&pf->pdev->dev, mem->size, mem->va, mem->pa); in i40e_free_dma_mem_d()
208 static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, in i40e_get_lump() argument
215 dev_info(&pf->pdev->dev, in i40e_get_lump()
224 if (pile == pf->qp_pile && pf->vsi[id]->type == I40E_VSI_FDIR) { in i40e_get_lump()
226 dev_err(&pf->pdev->dev, in i40e_get_lump()
297 struct i40e_vsi *i40e_find_vsi_from_id(struct i40e_pf *pf, u16 id) in i40e_find_vsi_from_id() argument
301 for (i = 0; i < pf->num_alloc_vsi; i++) in i40e_find_vsi_from_id()
302 if (pf->vsi[i] && (pf->vsi[i]->id == id)) in i40e_find_vsi_from_id()
303 return pf->vsi[i]; in i40e_find_vsi_from_id()
314 void i40e_service_event_schedule(struct i40e_pf *pf) in i40e_service_event_schedule() argument
316 if ((!test_bit(__I40E_DOWN, pf->state) && in i40e_service_event_schedule()
317 !test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) || in i40e_service_event_schedule()
318 test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_service_event_schedule()
319 queue_work(i40e_wq, &pf->service_task); in i40e_service_event_schedule()
335 struct i40e_pf *pf = vsi->back; in i40e_tx_timeout() local
340 pf->tx_timeout_count++; in i40e_tx_timeout()
353 if (time_after(jiffies, (pf->tx_timeout_last_recovery + HZ*20))) in i40e_tx_timeout()
354 pf->tx_timeout_recovery_level = 1; /* reset after some time */ in i40e_tx_timeout()
356 (pf->tx_timeout_last_recovery + netdev->watchdog_timeo))) in i40e_tx_timeout()
360 if (test_and_set_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state)) in i40e_tx_timeout()
366 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_tx_timeout()
367 val = rd32(&pf->hw, in i40e_tx_timeout()
371 val = rd32(&pf->hw, I40E_PFINT_DYN_CTL0); in i40e_tx_timeout()
379 pf->tx_timeout_last_recovery = jiffies; in i40e_tx_timeout()
381 pf->tx_timeout_recovery_level, txqueue); in i40e_tx_timeout()
383 switch (pf->tx_timeout_recovery_level) { in i40e_tx_timeout()
385 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_tx_timeout()
388 set_bit(__I40E_CORE_RESET_REQUESTED, pf->state); in i40e_tx_timeout()
391 set_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state); in i40e_tx_timeout()
395 set_bit(__I40E_DOWN_REQUESTED, pf->state); in i40e_tx_timeout()
400 i40e_service_event_schedule(pf); in i40e_tx_timeout()
401 pf->tx_timeout_recovery_level++; in i40e_tx_timeout()
538 void i40e_pf_reset_stats(struct i40e_pf *pf) in i40e_pf_reset_stats() argument
542 memset(&pf->stats, 0, sizeof(pf->stats)); in i40e_pf_reset_stats()
543 memset(&pf->stats_offsets, 0, sizeof(pf->stats_offsets)); in i40e_pf_reset_stats()
544 pf->stat_offsets_loaded = false; in i40e_pf_reset_stats()
547 if (pf->veb[i]) { in i40e_pf_reset_stats()
548 memset(&pf->veb[i]->stats, 0, in i40e_pf_reset_stats()
549 sizeof(pf->veb[i]->stats)); in i40e_pf_reset_stats()
550 memset(&pf->veb[i]->stats_offsets, 0, in i40e_pf_reset_stats()
551 sizeof(pf->veb[i]->stats_offsets)); in i40e_pf_reset_stats()
552 memset(&pf->veb[i]->tc_stats, 0, in i40e_pf_reset_stats()
553 sizeof(pf->veb[i]->tc_stats)); in i40e_pf_reset_stats()
554 memset(&pf->veb[i]->tc_stats_offsets, 0, in i40e_pf_reset_stats()
555 sizeof(pf->veb[i]->tc_stats_offsets)); in i40e_pf_reset_stats()
556 pf->veb[i]->stat_offsets_loaded = false; in i40e_pf_reset_stats()
559 pf->hw_csum_rx_error = 0; in i40e_pf_reset_stats()
709 struct i40e_pf *pf = vsi->back; in i40e_update_eth_stats() local
710 struct i40e_hw *hw = &pf->hw; in i40e_update_eth_stats()
774 struct i40e_pf *pf = veb->pf; in i40e_update_veb_stats() local
775 struct i40e_hw *hw = &pf->hw; in i40e_update_veb_stats()
860 struct i40e_pf *pf = vsi->back; in i40e_update_vsi_stats() local
877 test_bit(__I40E_CONFIG_BUSY, pf->state)) in i40e_update_vsi_stats()
986 if (vsi == pf->vsi[pf->lan_vsi]) { in i40e_update_vsi_stats()
987 ns->rx_crc_errors = pf->stats.crc_errors; in i40e_update_vsi_stats()
988 ns->rx_errors = pf->stats.crc_errors + pf->stats.illegal_bytes; in i40e_update_vsi_stats()
989 ns->rx_length_errors = pf->stats.rx_length_errors; in i40e_update_vsi_stats()
997 static void i40e_update_pf_stats(struct i40e_pf *pf) in i40e_update_pf_stats() argument
999 struct i40e_hw_port_stats *osd = &pf->stats_offsets; in i40e_update_pf_stats()
1000 struct i40e_hw_port_stats *nsd = &pf->stats; in i40e_update_pf_stats()
1001 struct i40e_hw *hw = &pf->hw; in i40e_update_pf_stats()
1007 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1011 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1014 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1019 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1024 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1029 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1034 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1039 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1044 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1049 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1054 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1058 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1062 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1066 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1071 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1076 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1079 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()
1090 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1094 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1098 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1102 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1107 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1114 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1118 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1122 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1126 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1130 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1134 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1138 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1143 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1147 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1151 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1155 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1159 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1163 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1167 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1171 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1174 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()
1202 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1205 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1208 if (pf->flags & I40E_FLAG_FD_SB_ENABLED && in i40e_update_pf_stats()
1209 !test_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state)) in i40e_update_pf_stats()
1214 if (pf->flags & I40E_FLAG_FD_ATR_ENABLED && in i40e_update_pf_stats()
1215 !test_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state)) in i40e_update_pf_stats()
1220 pf->stat_offsets_loaded = true; in i40e_update_pf_stats()
1231 struct i40e_pf *pf = vsi->back; in i40e_update_stats() local
1233 if (vsi == pf->vsi[pf->lan_vsi]) in i40e_update_stats()
1234 i40e_update_pf_stats(pf); in i40e_update_stats()
1474 struct i40e_pf *pf = vsi->back; in i40e_get_vf_new_vlan() local
1484 !(pf->flags & I40E_FLAG_VF_VLAN_PRUNING)); in i40e_get_vf_new_vlan()
1572 struct i40e_pf *pf = vsi->back; in i40e_rm_default_mac_filter() local
1583 i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL); in i40e_rm_default_mac_filter()
1591 i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL); in i40e_rm_default_mac_filter()
1790 struct i40e_pf *pf = vsi->back; in i40e_set_mac() local
1791 struct i40e_hw *hw = &pf->hw; in i40e_set_mac()
1797 if (test_bit(__I40E_DOWN, pf->state) || in i40e_set_mac()
1798 test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_set_mac()
1833 i40e_service_event_schedule(pf); in i40e_set_mac()
1847 struct i40e_pf *pf = vsi->back; in i40e_config_rss_aq() local
1848 struct i40e_hw *hw = &pf->hw; in i40e_config_rss_aq()
1856 dev_info(&pf->pdev->dev, in i40e_config_rss_aq()
1868 dev_info(&pf->pdev->dev, in i40e_config_rss_aq()
1884 struct i40e_pf *pf = vsi->back; in i40e_vsi_config_rss() local
1889 if (!(pf->hw_features & I40E_HW_RSS_AQ_CAPABLE)) in i40e_vsi_config_rss()
1892 vsi->rss_size = min_t(int, pf->alloc_rss_size, in i40e_vsi_config_rss()
1906 i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size); in i40e_vsi_config_rss()
2017 struct i40e_pf *pf = vsi->back; in i40e_vsi_setup_queue_map() local
2044 else if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_vsi_setup_queue_map()
2045 vsi->num_queue_pairs = pf->num_lan_msix; in i40e_vsi_setup_queue_map()
2064 dev_warn(&pf->pdev->dev, "DCB is enabled but no TC enabled, forcing TC0\n"); in i40e_vsi_setup_queue_map()
2069 i40e_pf_get_max_q_per_tc(pf)); in i40e_vsi_setup_queue_map()
2076 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_vsi_setup_queue_map()
2077 num_tc_qps = min_t(int, num_tc_qps, pf->num_lan_msix); in i40e_vsi_setup_queue_map()
2088 if (!(pf->flags & (I40E_FLAG_FD_SB_ENABLED | in i40e_vsi_setup_queue_map()
2091 qcount = min_t(int, pf->alloc_rss_size, in i40e_vsi_setup_queue_map()
2467 static int i40e_set_promiscuous(struct i40e_pf *pf, bool promisc) in i40e_set_promiscuous() argument
2469 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_set_promiscuous()
2470 struct i40e_hw *hw = &pf->hw; in i40e_set_promiscuous()
2474 pf->lan_veb != I40E_NO_VEB && in i40e_set_promiscuous()
2475 !(pf->flags & I40E_FLAG_MFP_ENABLED)) { in i40e_set_promiscuous()
2490 dev_info(&pf->pdev->dev, in i40e_set_promiscuous()
2502 dev_info(&pf->pdev->dev, in i40e_set_promiscuous()
2512 dev_info(&pf->pdev->dev, in i40e_set_promiscuous()
2520 pf->cur_promisc = promisc; in i40e_set_promiscuous()
2546 struct i40e_pf *pf; in i40e_sync_vsi_filters() local
2561 pf = vsi->back; in i40e_sync_vsi_filters()
2618 else if (pf->vf) in i40e_sync_vsi_filters()
2621 vlan_filters, pf->vf[vsi->vf_id].trusted); in i40e_sync_vsi_filters()
2783 dev_info(&pf->pdev->dev, in i40e_sync_vsi_filters()
2791 if (vsi->type == I40E_VSI_SRIOV && pf->vf && in i40e_sync_vsi_filters()
2792 !pf->vf[vsi->vf_id].trusted) { in i40e_sync_vsi_filters()
2817 dev_info(&pf->pdev->dev, in i40e_sync_vsi_filters()
2823 dev_info(&pf->pdev->dev, "%s allmulti mode.\n", in i40e_sync_vsi_filters()
2833 aq_ret = i40e_set_promiscuous(pf, cur_promisc); in i40e_sync_vsi_filters()
2837 dev_info(&pf->pdev->dev, in i40e_sync_vsi_filters()
2870 static void i40e_sync_filters_subtask(struct i40e_pf *pf) in i40e_sync_filters_subtask() argument
2874 if (!pf) in i40e_sync_filters_subtask()
2876 if (!test_and_clear_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state)) in i40e_sync_filters_subtask()
2878 if (test_bit(__I40E_VF_DISABLE, pf->state)) { in i40e_sync_filters_subtask()
2879 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_sync_filters_subtask()
2883 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_sync_filters_subtask()
2884 if (pf->vsi[v] && in i40e_sync_filters_subtask()
2885 (pf->vsi[v]->flags & I40E_VSI_FLAG_FILTER_CHANGED) && in i40e_sync_filters_subtask()
2886 !test_bit(__I40E_VSI_RELEASING, pf->vsi[v]->state)) { in i40e_sync_filters_subtask()
2887 int ret = i40e_sync_vsi_filters(pf->vsi[v]); in i40e_sync_filters_subtask()
2892 pf->state); in i40e_sync_filters_subtask()
2942 struct i40e_pf *pf = vsi->back; in i40e_change_mtu() local
2957 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_change_mtu()
2958 set_bit(__I40E_CLIENT_L2_CHANGE, pf->state); in i40e_change_mtu()
2971 struct i40e_pf *pf = np->vsi->back; in i40e_ioctl() local
2975 return i40e_ptp_get_ts_config(pf, ifr); in i40e_ioctl()
2977 return i40e_ptp_set_ts_config(pf, ifr); in i40e_ioctl()
3817 static void i40e_reset_fdir_filter_cnt(struct i40e_pf *pf) in i40e_reset_fdir_filter_cnt() argument
3819 pf->fd_tcp4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3820 pf->fd_udp4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3821 pf->fd_sctp4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3822 pf->fd_ip4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3823 pf->fd_tcp6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3824 pf->fd_udp6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3825 pf->fd_sctp6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3826 pf->fd_ip6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3839 struct i40e_pf *pf = vsi->back; in i40e_fdir_filter_restore() local
3842 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) in i40e_fdir_filter_restore()
3846 i40e_reset_fdir_filter_cnt(pf); in i40e_fdir_filter_restore()
3849 &pf->fdir_filter_list, fdir_node) { in i40e_fdir_filter_restore()
3879 struct i40e_pf *pf = vsi->back; in i40e_vsi_configure_msix() local
3880 struct i40e_hw *hw = &pf->hw; in i40e_vsi_configure_msix()
3962 static void i40e_enable_misc_int_causes(struct i40e_pf *pf) in i40e_enable_misc_int_causes() argument
3964 struct i40e_hw *hw = &pf->hw; in i40e_enable_misc_int_causes()
3980 if (pf->flags & I40E_FLAG_IWARP_ENABLED) in i40e_enable_misc_int_causes()
3983 if (pf->flags & I40E_FLAG_PTP) in i40e_enable_misc_int_causes()
4004 struct i40e_pf *pf = vsi->back; in i40e_configure_msi_and_legacy() local
4005 struct i40e_hw *hw = &pf->hw; in i40e_configure_msi_and_legacy()
4017 i40e_enable_misc_int_causes(pf); in i40e_configure_msi_and_legacy()
4043 void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf) in i40e_irq_dynamic_disable_icr0() argument
4045 struct i40e_hw *hw = &pf->hw; in i40e_irq_dynamic_disable_icr0()
4056 void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf) in i40e_irq_dynamic_enable_icr0() argument
4058 struct i40e_hw *hw = &pf->hw; in i40e_irq_dynamic_enable_icr0()
4123 struct i40e_pf *pf = vsi->back; in i40e_vsi_request_irq_msix() local
4134 irq_num = pf->msix_entries[base + vector].vector; in i40e_vsi_request_irq_msix()
4156 dev_info(&pf->pdev->dev, in i40e_vsi_request_irq_msix()
4182 irq_num = pf->msix_entries[base + vector].vector; in i40e_vsi_request_irq_msix()
4196 struct i40e_pf *pf = vsi->back; in i40e_vsi_disable_irq() local
4197 struct i40e_hw *hw = &pf->hw; in i40e_vsi_disable_irq()
4219 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_vsi_disable_irq()
4226 synchronize_irq(pf->msix_entries[i + base].vector); in i40e_vsi_disable_irq()
4232 synchronize_irq(pf->pdev->irq); in i40e_vsi_disable_irq()
4242 struct i40e_pf *pf = vsi->back; in i40e_vsi_enable_irq() local
4245 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_vsi_enable_irq()
4249 i40e_irq_dynamic_enable_icr0(pf); in i40e_vsi_enable_irq()
4252 i40e_flush(&pf->hw); in i40e_vsi_enable_irq()
4260 static void i40e_free_misc_vector(struct i40e_pf *pf) in i40e_free_misc_vector() argument
4263 wr32(&pf->hw, I40E_PFINT_ICR0_ENA, 0); in i40e_free_misc_vector()
4264 i40e_flush(&pf->hw); in i40e_free_misc_vector()
4266 if (pf->flags & I40E_FLAG_MSIX_ENABLED && pf->msix_entries) { in i40e_free_misc_vector()
4267 free_irq(pf->msix_entries[0].vector, pf); in i40e_free_misc_vector()
4268 clear_bit(__I40E_MISC_IRQ_REQUESTED, pf->state); in i40e_free_misc_vector()
4283 struct i40e_pf *pf = (struct i40e_pf *)data; in i40e_intr() local
4284 struct i40e_hw *hw = &pf->hw; in i40e_intr()
4299 pf->sw_int_count++; in i40e_intr()
4301 if ((pf->flags & I40E_FLAG_IWARP_ENABLED) && in i40e_intr()
4304 dev_dbg(&pf->pdev->dev, "cleared PE_CRITERR\n"); in i40e_intr()
4305 set_bit(__I40E_CORE_RESET_REQUESTED, pf->state); in i40e_intr()
4310 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_intr()
4319 if (!test_bit(__I40E_DOWN, pf->state)) in i40e_intr()
4325 set_bit(__I40E_ADMINQ_EVENT_PENDING, pf->state); in i40e_intr()
4326 i40e_debug(&pf->hw, I40E_DEBUG_NVM, "AdminQ event\n"); in i40e_intr()
4331 set_bit(__I40E_MDD_EVENT_PENDING, pf->state); in i40e_intr()
4336 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) { in i40e_intr()
4343 set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_intr()
4348 if (!test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_intr()
4349 set_bit(__I40E_RESET_INTR_RECEIVED, pf->state); in i40e_intr()
4355 pf->corer_count++; in i40e_intr()
4357 pf->globr_count++; in i40e_intr()
4359 pf->empr_count++; in i40e_intr()
4360 set_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state); in i40e_intr()
4366 dev_info(&pf->pdev->dev, "HMC error interrupt\n"); in i40e_intr()
4367 dev_info(&pf->pdev->dev, "HMC error info 0x%x, HMC error data 0x%x\n", in i40e_intr()
4376 schedule_work(&pf->ptp_extts0_work); in i40e_intr()
4379 i40e_ptp_tx_hwtstamp(pf); in i40e_intr()
4390 dev_info(&pf->pdev->dev, "unhandled interrupt icr0=0x%08x\n", in i40e_intr()
4395 dev_info(&pf->pdev->dev, "device will be reset\n"); in i40e_intr()
4396 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_intr()
4397 i40e_service_event_schedule(pf); in i40e_intr()
4406 if (!test_bit(__I40E_DOWN, pf->state) || in i40e_intr()
4407 test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_intr()
4408 i40e_service_event_schedule(pf); in i40e_intr()
4409 i40e_irq_dynamic_enable_icr0(pf); in i40e_intr()
4604 struct i40e_pf *pf = vsi->back; in i40e_vsi_request_irq() local
4607 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_vsi_request_irq()
4609 else if (pf->flags & I40E_FLAG_MSI_ENABLED) in i40e_vsi_request_irq()
4610 err = request_irq(pf->pdev->irq, i40e_intr, 0, in i40e_vsi_request_irq()
4611 pf->int_name, pf); in i40e_vsi_request_irq()
4613 err = request_irq(pf->pdev->irq, i40e_intr, IRQF_SHARED, in i40e_vsi_request_irq()
4614 pf->int_name, pf); in i40e_vsi_request_irq()
4617 dev_info(&pf->pdev->dev, "request_irq failed, Error %d\n", err); in i40e_vsi_request_irq()
4634 struct i40e_pf *pf = vsi->back; in i40e_netpoll() local
4641 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_netpoll()
4645 i40e_intr(pf->pdev->irq, netdev); in i40e_netpoll()
4663 static int i40e_pf_txq_wait(struct i40e_pf *pf, int pf_q, bool enable) in i40e_pf_txq_wait() argument
4669 tx_reg = rd32(&pf->hw, I40E_QTX_ENA(pf_q)); in i40e_pf_txq_wait()
4691 static void i40e_control_tx_q(struct i40e_pf *pf, int pf_q, bool enable) in i40e_control_tx_q() argument
4693 struct i40e_hw *hw = &pf->hw; in i40e_control_tx_q()
4698 i40e_pre_tx_queue_cfg(&pf->hw, pf_q, enable); in i40e_control_tx_q()
4733 int i40e_control_wait_tx_q(int seid, struct i40e_pf *pf, int pf_q, in i40e_control_wait_tx_q() argument
4738 i40e_control_tx_q(pf, pf_q, enable); in i40e_control_wait_tx_q()
4741 ret = i40e_pf_txq_wait(pf, pf_q, enable); in i40e_control_wait_tx_q()
4743 dev_info(&pf->pdev->dev, in i40e_control_wait_tx_q()
4758 struct i40e_pf *pf = vsi->back; in i40e_vsi_enable_tx() local
4763 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_vsi_enable_tx()
4772 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_vsi_enable_tx()
4792 static int i40e_pf_rxq_wait(struct i40e_pf *pf, int pf_q, bool enable) in i40e_pf_rxq_wait() argument
4798 rx_reg = rd32(&pf->hw, I40E_QRX_ENA(pf_q)); in i40e_pf_rxq_wait()
4820 static void i40e_control_rx_q(struct i40e_pf *pf, int pf_q, bool enable) in i40e_control_rx_q() argument
4822 struct i40e_hw *hw = &pf->hw; in i40e_control_rx_q()
4857 int i40e_control_wait_rx_q(struct i40e_pf *pf, int pf_q, bool enable) in i40e_control_wait_rx_q() argument
4861 i40e_control_rx_q(pf, pf_q, enable); in i40e_control_wait_rx_q()
4864 ret = i40e_pf_rxq_wait(pf, pf_q, enable); in i40e_control_wait_rx_q()
4877 struct i40e_pf *pf = vsi->back; in i40e_vsi_enable_rx() local
4882 ret = i40e_control_wait_rx_q(pf, pf_q, true); in i40e_vsi_enable_rx()
4884 dev_info(&pf->pdev->dev, in i40e_vsi_enable_rx()
4919 struct i40e_pf *pf = vsi->back; in i40e_vsi_stop_rings() local
4928 i40e_pre_tx_queue_cfg(&pf->hw, (u32)pf_q, false); in i40e_vsi_stop_rings()
4931 err = i40e_control_wait_rx_q(pf, pf_q, false); in i40e_vsi_stop_rings()
4933 dev_info(&pf->pdev->dev, in i40e_vsi_stop_rings()
4941 wr32(&pf->hw, I40E_QTX_ENA(pf_q), 0); in i40e_vsi_stop_rings()
4959 struct i40e_pf *pf = vsi->back; in i40e_vsi_stop_rings_no_wait() local
4964 i40e_control_tx_q(pf, pf_q, false); in i40e_vsi_stop_rings_no_wait()
4965 i40e_control_rx_q(pf, pf_q, false); in i40e_vsi_stop_rings_no_wait()
4975 struct i40e_pf *pf = vsi->back; in i40e_vsi_free_irq() local
4976 struct i40e_hw *hw = &pf->hw; in i40e_vsi_free_irq()
4981 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_vsi_free_irq()
4994 irq_num = pf->msix_entries[vector].vector; in i40e_vsi_free_irq()
5054 free_irq(pf->pdev->irq, pf); in i40e_vsi_free_irq()
5140 static void i40e_reset_interrupt_capability(struct i40e_pf *pf) in i40e_reset_interrupt_capability() argument
5143 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_reset_interrupt_capability()
5144 pci_disable_msix(pf->pdev); in i40e_reset_interrupt_capability()
5145 kfree(pf->msix_entries); in i40e_reset_interrupt_capability()
5146 pf->msix_entries = NULL; in i40e_reset_interrupt_capability()
5147 kfree(pf->irq_pile); in i40e_reset_interrupt_capability()
5148 pf->irq_pile = NULL; in i40e_reset_interrupt_capability()
5149 } else if (pf->flags & I40E_FLAG_MSI_ENABLED) { in i40e_reset_interrupt_capability()
5150 pci_disable_msi(pf->pdev); in i40e_reset_interrupt_capability()
5152 pf->flags &= ~(I40E_FLAG_MSIX_ENABLED | I40E_FLAG_MSI_ENABLED); in i40e_reset_interrupt_capability()
5162 static void i40e_clear_interrupt_scheme(struct i40e_pf *pf) in i40e_clear_interrupt_scheme() argument
5166 if (test_bit(__I40E_MISC_IRQ_REQUESTED, pf->state)) in i40e_clear_interrupt_scheme()
5167 i40e_free_misc_vector(pf); in i40e_clear_interrupt_scheme()
5169 i40e_put_lump(pf->irq_pile, pf->iwarp_base_vector, in i40e_clear_interrupt_scheme()
5172 i40e_put_lump(pf->irq_pile, 0, I40E_PILE_VALID_BIT-1); in i40e_clear_interrupt_scheme()
5173 for (i = 0; i < pf->num_alloc_vsi; i++) in i40e_clear_interrupt_scheme()
5174 if (pf->vsi[i]) in i40e_clear_interrupt_scheme()
5175 i40e_vsi_free_q_vectors(pf->vsi[i]); in i40e_clear_interrupt_scheme()
5176 i40e_reset_interrupt_capability(pf); in i40e_clear_interrupt_scheme()
5223 struct i40e_pf *pf = vsi->back; in i40e_vsi_close() local
5230 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_vsi_close()
5231 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_vsi_close()
5232 set_bit(__I40E_CLIENT_RESET, pf->state); in i40e_vsi_close()
5270 static void i40e_pf_quiesce_all_vsi(struct i40e_pf *pf) in i40e_pf_quiesce_all_vsi() argument
5274 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_pf_quiesce_all_vsi()
5275 if (pf->vsi[v]) in i40e_pf_quiesce_all_vsi()
5276 i40e_quiesce_vsi(pf->vsi[v]); in i40e_pf_quiesce_all_vsi()
5284 static void i40e_pf_unquiesce_all_vsi(struct i40e_pf *pf) in i40e_pf_unquiesce_all_vsi() argument
5288 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_pf_unquiesce_all_vsi()
5289 if (pf->vsi[v]) in i40e_pf_unquiesce_all_vsi()
5290 i40e_unquiesce_vsi(pf->vsi[v]); in i40e_pf_unquiesce_all_vsi()
5302 struct i40e_pf *pf = vsi->back; in i40e_vsi_wait_queues_disabled() local
5308 ret = i40e_pf_txq_wait(pf, pf_q, false); in i40e_vsi_wait_queues_disabled()
5310 dev_info(&pf->pdev->dev, in i40e_vsi_wait_queues_disabled()
5320 ret = i40e_pf_txq_wait(pf, pf_q + vsi->alloc_queue_pairs, in i40e_vsi_wait_queues_disabled()
5323 dev_info(&pf->pdev->dev, in i40e_vsi_wait_queues_disabled()
5330 ret = i40e_pf_rxq_wait(pf, pf_q, false); in i40e_vsi_wait_queues_disabled()
5332 dev_info(&pf->pdev->dev, in i40e_vsi_wait_queues_disabled()
5350 static int i40e_pf_wait_queues_disabled(struct i40e_pf *pf) in i40e_pf_wait_queues_disabled() argument
5354 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_pf_wait_queues_disabled()
5355 if (pf->vsi[v]) { in i40e_pf_wait_queues_disabled()
5356 ret = i40e_vsi_wait_queues_disabled(pf->vsi[v]); in i40e_pf_wait_queues_disabled()
5374 static u8 i40e_get_iscsi_tc_map(struct i40e_pf *pf) in i40e_get_iscsi_tc_map() argument
5377 struct i40e_hw *hw = &pf->hw; in i40e_get_iscsi_tc_map()
5464 static u8 i40e_mqprio_get_enabled_tc(struct i40e_pf *pf) in i40e_mqprio_get_enabled_tc() argument
5466 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_mqprio_get_enabled_tc()
5481 static u8 i40e_pf_get_num_tc(struct i40e_pf *pf) in i40e_pf_get_num_tc() argument
5483 struct i40e_hw *hw = &pf->hw; in i40e_pf_get_num_tc()
5488 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_pf_get_num_tc()
5489 return pf->vsi[pf->lan_vsi]->mqprio_qopt.qopt.num_tc; in i40e_pf_get_num_tc()
5492 if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) in i40e_pf_get_num_tc()
5496 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) in i40e_pf_get_num_tc()
5500 if (pf->hw.func_caps.iscsi) in i40e_pf_get_num_tc()
5501 enabled_tc = i40e_get_iscsi_tc_map(pf); in i40e_pf_get_num_tc()
5518 static u8 i40e_pf_get_tc_map(struct i40e_pf *pf) in i40e_pf_get_tc_map() argument
5520 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_pf_get_tc_map()
5521 return i40e_mqprio_get_enabled_tc(pf); in i40e_pf_get_tc_map()
5526 if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) in i40e_pf_get_tc_map()
5530 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) in i40e_pf_get_tc_map()
5531 return i40e_dcb_get_enabled_tc(&pf->hw.local_dcbx_config); in i40e_pf_get_tc_map()
5534 if (pf->hw.func_caps.iscsi) in i40e_pf_get_tc_map()
5535 return i40e_get_iscsi_tc_map(pf); in i40e_pf_get_tc_map()
5550 struct i40e_pf *pf = vsi->back; in i40e_vsi_get_bw_info() local
5551 struct i40e_hw *hw = &pf->hw; in i40e_vsi_get_bw_info()
5559 dev_info(&pf->pdev->dev, in i40e_vsi_get_bw_info()
5562 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vsi_get_bw_info()
5570 dev_info(&pf->pdev->dev, in i40e_vsi_get_bw_info()
5573 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vsi_get_bw_info()
5578 dev_info(&pf->pdev->dev, in i40e_vsi_get_bw_info()
5612 struct i40e_pf *pf = vsi->back; in i40e_vsi_configure_bw_alloc() local
5617 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_vsi_configure_bw_alloc()
5619 if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) { in i40e_vsi_configure_bw_alloc()
5622 dev_info(&pf->pdev->dev, in i40e_vsi_configure_bw_alloc()
5632 ret = i40e_aq_config_vsi_tc_bw(&pf->hw, vsi->seid, &bw_data, NULL); in i40e_vsi_configure_bw_alloc()
5634 dev_info(&pf->pdev->dev, in i40e_vsi_configure_bw_alloc()
5636 pf->hw.aq.asq_last_status); in i40e_vsi_configure_bw_alloc()
5655 struct i40e_pf *pf = vsi->back; in i40e_vsi_config_netdev_tc() local
5656 struct i40e_hw *hw = &pf->hw; in i40e_vsi_config_netdev_tc()
5689 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_vsi_config_netdev_tc()
5729 struct i40e_pf *pf; in i40e_update_adq_vsi_queues() local
5735 pf = vsi->back; in i40e_update_adq_vsi_queues()
5736 hw = &pf->hw; in i40e_update_adq_vsi_queues()
5749 vsi->rss_size = min_t(int, pf->alloc_rss_size, in i40e_update_adq_vsi_queues()
5753 dev_info(&pf->pdev->dev, "Failed to reconfig rss for num_queues\n"); in i40e_update_adq_vsi_queues()
5761 dev_info(&pf->pdev->dev, "Update vsi config failed, err %pe aq_err %s\n", in i40e_update_adq_vsi_queues()
5789 struct i40e_pf *pf = vsi->back; in i40e_vsi_config_tc() local
5790 struct i40e_hw *hw = &pf->hw; in i40e_vsi_config_tc()
5810 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5816 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5829 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5837 dev_err(&pf->pdev->dev, in i40e_vsi_config_tc()
5850 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_vsi_config_tc()
5883 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5896 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5916 struct i40e_pf *pf = vsi->back; in i40e_get_link_speed() local
5918 switch (pf->hw.phy.link_info.link_speed) { in i40e_get_link_speed()
5964 struct i40e_pf *pf = vsi->back; in i40e_set_bw_limit() local
5971 dev_err(&pf->pdev->dev, in i40e_set_bw_limit()
5977 dev_warn(&pf->pdev->dev, in i40e_set_bw_limit()
5985 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, seid, credits, in i40e_set_bw_limit()
5988 dev_err(&pf->pdev->dev, in i40e_set_bw_limit()
5991 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_set_bw_limit()
6006 struct i40e_pf *pf = vsi->back; in i40e_remove_queue_channels() local
6050 &pf->cloud_filter_list, cloud_node) { in i40e_remove_queue_channels()
6062 last_aq_status = pf->hw.aq.asq_last_status; in i40e_remove_queue_channels()
6064 dev_info(&pf->pdev->dev, in i40e_remove_queue_channels()
6067 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_remove_queue_channels()
6116 static int i40e_validate_num_queues(struct i40e_pf *pf, int num_queues, in i40e_validate_num_queues() argument
6127 dev_dbg(&pf->pdev->dev, in i40e_validate_num_queues()
6133 dev_dbg(&pf->pdev->dev, in i40e_validate_num_queues()
6148 dev_dbg(&pf->pdev->dev, in i40e_validate_num_queues()
6168 struct i40e_pf *pf = vsi->back; in i40e_vsi_reconfig_rss() local
6170 struct i40e_hw *hw = &pf->hw; in i40e_vsi_reconfig_rss()
6187 i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, local_rss_size); in i40e_vsi_reconfig_rss()
6199 dev_info(&pf->pdev->dev, in i40e_vsi_reconfig_rss()
6224 static void i40e_channel_setup_queue_map(struct i40e_pf *pf, in i40e_channel_setup_queue_map() argument
6235 qcount = min_t(int, ch->num_queue_pairs, pf->num_lan_msix); in i40e_channel_setup_queue_map()
6263 static int i40e_add_channel(struct i40e_pf *pf, u16 uplink_seid, in i40e_add_channel() argument
6266 struct i40e_hw *hw = &pf->hw; in i40e_add_channel()
6272 dev_info(&pf->pdev->dev, in i40e_add_channel()
6285 if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED) { in i40e_add_channel()
6293 i40e_channel_setup_queue_map(pf, &ctxt, ch); in i40e_add_channel()
6298 dev_info(&pf->pdev->dev, in i40e_add_channel()
6301 i40e_aq_str(&pf->hw, in i40e_add_channel()
6302 pf->hw.aq.asq_last_status)); in i40e_add_channel()
6363 static int i40e_channel_config_tx_ring(struct i40e_pf *pf, in i40e_channel_config_tx_ring() argument
6417 static inline int i40e_setup_hw_channel(struct i40e_pf *pf, in i40e_setup_hw_channel() argument
6429 ret = i40e_add_channel(pf, uplink_seid, ch); in i40e_setup_hw_channel()
6431 dev_info(&pf->pdev->dev, in i40e_setup_hw_channel()
6441 ret = i40e_channel_config_tx_ring(pf, vsi, ch); in i40e_setup_hw_channel()
6443 dev_info(&pf->pdev->dev, in i40e_setup_hw_channel()
6451 dev_dbg(&pf->pdev->dev, in i40e_setup_hw_channel()
6468 static bool i40e_setup_channel(struct i40e_pf *pf, struct i40e_vsi *vsi, in i40e_setup_channel() argument
6478 dev_err(&pf->pdev->dev, "unsupported parent vsi type(%d)\n", in i40e_setup_channel()
6484 seid = pf->vsi[pf->lan_vsi]->uplink_seid; in i40e_setup_channel()
6487 ret = i40e_setup_hw_channel(pf, vsi, ch, seid, vsi_type); in i40e_setup_channel()
6489 dev_err(&pf->pdev->dev, "failed to setup hw_channel\n"); in i40e_setup_channel()
6506 struct i40e_pf *pf = vsi->back; in i40e_validate_and_set_switch_mode() local
6507 struct i40e_hw *hw = &pf->hw; in i40e_validate_and_set_switch_mode()
6510 ret = i40e_get_capabilities(pf, i40e_aqc_opc_list_dev_capabilities); in i40e_validate_and_set_switch_mode()
6523 dev_err(&pf->pdev->dev, in i40e_validate_and_set_switch_mode()
6540 ret = i40e_aq_set_switch_config(hw, pf->last_sw_conf_flags, in i40e_validate_and_set_switch_mode()
6541 pf->last_sw_conf_valid_flags, in i40e_validate_and_set_switch_mode()
6544 dev_err(&pf->pdev->dev, in i40e_validate_and_set_switch_mode()
6564 struct i40e_pf *pf = vsi->back; in i40e_create_queue_channel() local
6572 dev_err(&pf->pdev->dev, "Invalid num_queues requested: %d\n", in i40e_create_queue_channel()
6578 err = i40e_validate_num_queues(pf, ch->num_queue_pairs, vsi, in i40e_create_queue_channel()
6581 dev_info(&pf->pdev->dev, "Failed to validate num_queues (%d)\n", in i40e_create_queue_channel()
6590 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_create_queue_channel()
6591 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_create_queue_channel()
6594 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_create_queue_channel()
6595 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_create_queue_channel()
6597 i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG); in i40e_create_queue_channel()
6608 dev_dbg(&pf->pdev->dev, in i40e_create_queue_channel()
6618 dev_info(&pf->pdev->dev, in i40e_create_queue_channel()
6625 if (!i40e_setup_channel(pf, vsi, ch)) { in i40e_create_queue_channel()
6626 dev_info(&pf->pdev->dev, "Failed to setup channel\n"); in i40e_create_queue_channel()
6630 dev_info(&pf->pdev->dev, in i40e_create_queue_channel()
6642 dev_dbg(&pf->pdev->dev, in i40e_create_queue_channel()
6725 struct i40e_pf *pf = veb->pf; in i40e_veb_config_tc() local
6742 ret = i40e_aq_config_switch_comp_bw_config(&pf->hw, veb->seid, in i40e_veb_config_tc()
6745 dev_info(&pf->pdev->dev, in i40e_veb_config_tc()
6748 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_veb_config_tc()
6755 dev_info(&pf->pdev->dev, in i40e_veb_config_tc()
6758 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_veb_config_tc()
6774 static void i40e_dcb_reconfigure(struct i40e_pf *pf) in i40e_dcb_reconfigure() argument
6781 tc_map = i40e_pf_get_tc_map(pf); in i40e_dcb_reconfigure()
6786 if (!pf->veb[v]) in i40e_dcb_reconfigure()
6788 ret = i40e_veb_config_tc(pf->veb[v], tc_map); in i40e_dcb_reconfigure()
6790 dev_info(&pf->pdev->dev, in i40e_dcb_reconfigure()
6792 pf->veb[v]->seid); in i40e_dcb_reconfigure()
6798 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_dcb_reconfigure()
6799 if (!pf->vsi[v]) in i40e_dcb_reconfigure()
6805 if (v == pf->lan_vsi) in i40e_dcb_reconfigure()
6806 tc_map = i40e_pf_get_tc_map(pf); in i40e_dcb_reconfigure()
6810 ret = i40e_vsi_config_tc(pf->vsi[v], tc_map); in i40e_dcb_reconfigure()
6812 dev_info(&pf->pdev->dev, in i40e_dcb_reconfigure()
6814 pf->vsi[v]->seid); in i40e_dcb_reconfigure()
6818 i40e_vsi_map_rings_to_vectors(pf->vsi[v]); in i40e_dcb_reconfigure()
6819 if (pf->vsi[v]->netdev) in i40e_dcb_reconfigure()
6820 i40e_dcbnl_set_all(pf->vsi[v]); in i40e_dcb_reconfigure()
6832 static int i40e_resume_port_tx(struct i40e_pf *pf) in i40e_resume_port_tx() argument
6834 struct i40e_hw *hw = &pf->hw; in i40e_resume_port_tx()
6839 dev_info(&pf->pdev->dev, in i40e_resume_port_tx()
6842 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_resume_port_tx()
6844 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_resume_port_tx()
6845 i40e_service_event_schedule(pf); in i40e_resume_port_tx()
6857 static int i40e_suspend_port_tx(struct i40e_pf *pf) in i40e_suspend_port_tx() argument
6859 struct i40e_hw *hw = &pf->hw; in i40e_suspend_port_tx()
6862 ret = i40e_aq_suspend_port_tx(hw, pf->mac_seid, NULL); in i40e_suspend_port_tx()
6864 dev_info(&pf->pdev->dev, in i40e_suspend_port_tx()
6867 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_suspend_port_tx()
6869 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_suspend_port_tx()
6870 i40e_service_event_schedule(pf); in i40e_suspend_port_tx()
6884 static int i40e_hw_set_dcb_config(struct i40e_pf *pf, in i40e_hw_set_dcb_config() argument
6887 struct i40e_dcbx_config *old_cfg = &pf->hw.local_dcbx_config; in i40e_hw_set_dcb_config()
6892 dev_dbg(&pf->pdev->dev, "No Change in DCB Config required.\n"); in i40e_hw_set_dcb_config()
6897 i40e_pf_quiesce_all_vsi(pf); in i40e_hw_set_dcb_config()
6902 ret = i40e_set_dcb_config(&pf->hw); in i40e_hw_set_dcb_config()
6904 dev_info(&pf->pdev->dev, in i40e_hw_set_dcb_config()
6907 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_hw_set_dcb_config()
6912 i40e_dcb_reconfigure(pf); in i40e_hw_set_dcb_config()
6915 if (!test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) { in i40e_hw_set_dcb_config()
6917 ret = i40e_resume_port_tx(pf); in i40e_hw_set_dcb_config()
6921 i40e_pf_unquiesce_all_vsi(pf); in i40e_hw_set_dcb_config()
6935 int i40e_hw_dcb_config(struct i40e_pf *pf, struct i40e_dcbx_config *new_cfg) in i40e_hw_dcb_config() argument
6943 struct i40e_hw *hw = &pf->hw; in i40e_hw_dcb_config()
6952 dev_dbg(&pf->pdev->dev, "Configuring DCB registers directly\n"); in i40e_hw_dcb_config()
6994 need_reconfig = i40e_dcb_need_reconfig(pf, old_cfg, new_cfg); in i40e_hw_dcb_config()
7002 pf->flags |= I40E_FLAG_DCB_ENABLED; in i40e_hw_dcb_config()
7004 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_hw_dcb_config()
7006 set_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_hw_dcb_config()
7008 i40e_pf_quiesce_all_vsi(pf); in i40e_hw_dcb_config()
7009 ret = i40e_suspend_port_tx(pf); in i40e_hw_dcb_config()
7018 (hw, pf->mac_seid, &ets_data, in i40e_hw_dcb_config()
7021 dev_info(&pf->pdev->dev, in i40e_hw_dcb_config()
7024 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_hw_dcb_config()
7044 mfs_tc[i] = pf->vsi[pf->lan_vsi]->netdev->mtu; in i40e_hw_dcb_config()
7051 i40e_dcb_hw_rx_pb_config(hw, &pf->pb_cfg, &pb_cfg); in i40e_hw_dcb_config()
7054 pf->pb_cfg = pb_cfg; in i40e_hw_dcb_config()
7057 ret = i40e_aq_dcb_updated(&pf->hw, NULL); in i40e_hw_dcb_config()
7059 dev_info(&pf->pdev->dev, in i40e_hw_dcb_config()
7062 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_hw_dcb_config()
7070 i40e_dcb_reconfigure(pf); in i40e_hw_dcb_config()
7074 ret = i40e_resume_port_tx(pf); in i40e_hw_dcb_config()
7076 clear_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_hw_dcb_config()
7082 ret = i40e_pf_wait_queues_disabled(pf); in i40e_hw_dcb_config()
7085 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_hw_dcb_config()
7086 i40e_service_event_schedule(pf); in i40e_hw_dcb_config()
7089 i40e_pf_unquiesce_all_vsi(pf); in i40e_hw_dcb_config()
7090 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_hw_dcb_config()
7091 set_bit(__I40E_CLIENT_L2_CHANGE, pf->state); in i40e_hw_dcb_config()
7094 if (pf->hw_features & I40E_HW_USE_SET_LLDP_MIB) in i40e_hw_dcb_config()
7095 ret = i40e_hw_set_dcb_config(pf, new_cfg); in i40e_hw_dcb_config()
7108 int i40e_dcb_sw_default_config(struct i40e_pf *pf) in i40e_dcb_sw_default_config() argument
7110 struct i40e_dcbx_config *dcb_cfg = &pf->hw.local_dcbx_config; in i40e_dcb_sw_default_config()
7112 struct i40e_hw *hw = &pf->hw; in i40e_dcb_sw_default_config()
7115 if (pf->hw_features & I40E_HW_USE_SET_LLDP_MIB) { in i40e_dcb_sw_default_config()
7117 memset(&pf->tmp_cfg, 0, sizeof(struct i40e_dcbx_config)); in i40e_dcb_sw_default_config()
7118 pf->tmp_cfg.etscfg.willing = I40E_IEEE_DEFAULT_ETS_WILLING; in i40e_dcb_sw_default_config()
7119 pf->tmp_cfg.etscfg.maxtcs = 0; in i40e_dcb_sw_default_config()
7120 pf->tmp_cfg.etscfg.tcbwtable[0] = I40E_IEEE_DEFAULT_ETS_TCBW; in i40e_dcb_sw_default_config()
7121 pf->tmp_cfg.etscfg.tsatable[0] = I40E_IEEE_TSA_ETS; in i40e_dcb_sw_default_config()
7122 pf->tmp_cfg.pfc.willing = I40E_IEEE_DEFAULT_PFC_WILLING; in i40e_dcb_sw_default_config()
7123 pf->tmp_cfg.pfc.pfccap = I40E_MAX_TRAFFIC_CLASS; in i40e_dcb_sw_default_config()
7125 pf->tmp_cfg.numapps = I40E_IEEE_DEFAULT_NUM_APPS; in i40e_dcb_sw_default_config()
7126 pf->tmp_cfg.app[0].selector = I40E_APP_SEL_ETHTYPE; in i40e_dcb_sw_default_config()
7127 pf->tmp_cfg.app[0].priority = I40E_IEEE_DEFAULT_APP_PRIO; in i40e_dcb_sw_default_config()
7128 pf->tmp_cfg.app[0].protocolid = I40E_APP_PROTOID_FCOE; in i40e_dcb_sw_default_config()
7130 return i40e_hw_set_dcb_config(pf, &pf->tmp_cfg); in i40e_dcb_sw_default_config()
7140 (hw, pf->mac_seid, &ets_data, in i40e_dcb_sw_default_config()
7143 dev_info(&pf->pdev->dev, in i40e_dcb_sw_default_config()
7146 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_dcb_sw_default_config()
7168 static int i40e_init_pf_dcb(struct i40e_pf *pf) in i40e_init_pf_dcb() argument
7170 struct i40e_hw *hw = &pf->hw; in i40e_init_pf_dcb()
7176 if (pf->hw_features & I40E_HW_NO_DCB_SUPPORT) { in i40e_init_pf_dcb()
7177 dev_info(&pf->pdev->dev, "DCB is not supported.\n"); in i40e_init_pf_dcb()
7181 if (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) { in i40e_init_pf_dcb()
7182 dev_info(&pf->pdev->dev, "FW LLDP is disabled, attempting SW DCB\n"); in i40e_init_pf_dcb()
7183 err = i40e_dcb_sw_default_config(pf); in i40e_init_pf_dcb()
7185 dev_info(&pf->pdev->dev, "Could not initialize SW DCB\n"); in i40e_init_pf_dcb()
7188 dev_info(&pf->pdev->dev, "SW DCB initialization succeeded.\n"); in i40e_init_pf_dcb()
7189 pf->dcbx_cap = DCB_CAP_DCBX_HOST | in i40e_init_pf_dcb()
7192 pf->flags |= I40E_FLAG_DCB_CAPABLE; in i40e_init_pf_dcb()
7193 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_init_pf_dcb()
7201 dev_info(&pf->pdev->dev, in i40e_init_pf_dcb()
7205 pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED | in i40e_init_pf_dcb()
7208 pf->flags |= I40E_FLAG_DCB_CAPABLE; in i40e_init_pf_dcb()
7213 pf->flags |= I40E_FLAG_DCB_ENABLED; in i40e_init_pf_dcb()
7215 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_init_pf_dcb()
7216 dev_dbg(&pf->pdev->dev, in i40e_init_pf_dcb()
7219 } else if (pf->hw.aq.asq_last_status == I40E_AQ_RC_EPERM) { in i40e_init_pf_dcb()
7220 dev_info(&pf->pdev->dev, "FW LLDP disabled for this PF.\n"); in i40e_init_pf_dcb()
7221 pf->flags |= I40E_FLAG_DISABLE_FW_LLDP; in i40e_init_pf_dcb()
7223 dev_info(&pf->pdev->dev, in i40e_init_pf_dcb()
7226 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_init_pf_dcb()
7242 struct i40e_pf *pf = vsi->back; in i40e_print_link_message() local
7250 new_speed = pf->hw.phy.link_info.link_speed; in i40e_print_link_message()
7266 if (pf->hw.func_caps.npar_enable && in i40e_print_link_message()
7267 (pf->hw.phy.link_info.link_speed == I40E_LINK_SPEED_1GB || in i40e_print_link_message()
7268 pf->hw.phy.link_info.link_speed == I40E_LINK_SPEED_100MB)) in i40e_print_link_message()
7272 switch (pf->hw.phy.link_info.link_speed) { in i40e_print_link_message()
7301 switch (pf->hw.fc.current_mode) { in i40e_print_link_message()
7316 if (pf->hw.phy.link_info.link_speed == I40E_LINK_SPEED_25GB) { in i40e_print_link_message()
7321 if (pf->hw.phy.link_info.an_info & I40E_AQ_AN_COMPLETED) in i40e_print_link_message()
7324 if (pf->hw.phy.link_info.fec_info & in i40e_print_link_message()
7327 else if (pf->hw.phy.link_info.fec_info & in i40e_print_link_message()
7345 } else if (pf->hw.device_id == I40E_DEV_ID_KX_X722) { in i40e_print_link_message()
7350 if (pf->hw.phy.link_info.an_info & I40E_AQ_AN_COMPLETED) in i40e_print_link_message()
7353 if (pf->hw.phy.link_info.fec_info & in i40e_print_link_message()
7357 if (pf->hw.phy.link_info.req_fec_info & in i40e_print_link_message()
7378 struct i40e_pf *pf = vsi->back; in i40e_up_complete() local
7381 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_up_complete()
7395 if ((pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP) && in i40e_up_complete()
7405 pf->fd_add_err = 0; in i40e_up_complete()
7406 pf->fd_atr_cnt = 0; in i40e_up_complete()
7413 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_up_complete()
7414 i40e_service_event_schedule(pf); in i40e_up_complete()
7428 struct i40e_pf *pf = vsi->back; in i40e_vsi_reinit_locked() local
7430 while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) in i40e_vsi_reinit_locked()
7435 clear_bit(__I40E_CONFIG_BUSY, pf->state); in i40e_vsi_reinit_locked()
7443 static int i40e_force_link_state(struct i40e_pf *pf, bool is_up) in i40e_force_link_state() argument
7448 struct i40e_hw *hw = &pf->hw; in i40e_force_link_state()
7462 dev_err(&pf->pdev->dev, in i40e_force_link_state()
7474 dev_err(&pf->pdev->dev, in i40e_force_link_state()
7485 if (pf->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED) in i40e_force_link_state()
7501 if (pf->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED) { in i40e_force_link_state()
7519 dev_err(&pf->pdev->dev, in i40e_force_link_state()
7522 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_force_link_state()
7807 struct i40e_pf *pf = vsi->back; in i40e_fwd_ring_up() local
7808 struct i40e_hw *hw = &pf->hw; in i40e_fwd_ring_up()
7860 dev_info(&pf->pdev->dev, in i40e_fwd_ring_up()
7880 struct i40e_pf *pf = vsi->back; in i40e_setup_macvlans() local
7881 struct i40e_hw *hw = &pf->hw; in i40e_setup_macvlans()
7917 dev_info(&pf->pdev->dev, in i40e_setup_macvlans()
7933 dev_info(&pf->pdev->dev, in i40e_setup_macvlans()
7953 if (!i40e_setup_channel(pf, vsi, ch)) { in i40e_setup_macvlans()
7967 dev_info(&pf->pdev->dev, "Failed to setup macvlans\n"); in i40e_setup_macvlans()
7983 struct i40e_pf *pf = vsi->back; in i40e_fwd_add() local
7987 if ((pf->flags & I40E_FLAG_DCB_ENABLED)) { in i40e_fwd_add()
7991 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_fwd_add()
7995 if (pf->num_lan_msix < I40E_MIN_MACVLAN_VECTORS) { in i40e_fwd_add()
8014 vectors = pf->num_lan_msix; in i40e_fwd_add()
8091 struct i40e_pf *pf = vsi->back; in i40e_del_all_macvlans() local
8092 struct i40e_hw *hw = &pf->hw; in i40e_del_all_macvlans()
8128 struct i40e_pf *pf = vsi->back; in i40e_fwd_del() local
8129 struct i40e_hw *hw = &pf->hw; in i40e_fwd_del()
8149 dev_info(&pf->pdev->dev, in i40e_fwd_del()
8169 struct i40e_pf *pf = vsi->back; in i40e_setup_tc() local
8182 pf->flags &= ~I40E_FLAG_TC_MQPRIO; in i40e_setup_tc()
8188 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_setup_tc()
8195 pf->flags &= ~I40E_FLAG_TC_MQPRIO; in i40e_setup_tc()
8198 if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) { in i40e_setup_tc()
8205 if (num_tc > i40e_pf_get_num_tc(pf)) { in i40e_setup_tc()
8212 if (pf->flags & I40E_FLAG_DCB_ENABLED) { in i40e_setup_tc()
8217 if (!(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_setup_tc()
8224 pf->flags |= I40E_FLAG_TC_MQPRIO; in i40e_setup_tc()
8225 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_setup_tc()
8244 if (!hw && !i40e_is_tc_mqprio_enabled(pf)) in i40e_setup_tc()
8268 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_setup_tc()
8366 struct i40e_pf *pf = vsi->back; in i40e_add_del_cloud_filter() local
8405 ret = i40e_aq_add_cloud_filters(&pf->hw, filter->seid, in i40e_add_del_cloud_filter()
8408 ret = i40e_aq_rem_cloud_filters(&pf->hw, filter->seid, in i40e_add_del_cloud_filter()
8411 dev_dbg(&pf->pdev->dev, in i40e_add_del_cloud_filter()
8414 pf->hw.aq.asq_last_status); in i40e_add_del_cloud_filter()
8416 dev_info(&pf->pdev->dev, in i40e_add_del_cloud_filter()
8436 struct i40e_pf *pf = vsi->back; in i40e_add_del_cloud_filter_big_buf() local
8494 dev_err(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8507 dev_err(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8513 ret = i40e_aq_add_cloud_filters_bb(&pf->hw, filter->seid, in i40e_add_del_cloud_filter_big_buf()
8516 ret = i40e_aq_rem_cloud_filters_bb(&pf->hw, filter->seid, in i40e_add_del_cloud_filter_big_buf()
8521 dev_dbg(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8523 add ? "add" : "delete", ret, pf->hw.aq.asq_last_status); in i40e_add_del_cloud_filter_big_buf()
8525 dev_info(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8546 struct i40e_pf *pf = vsi->back; in i40e_parse_cls_flower() local
8558 dev_err(&pf->pdev->dev, "Unsupported key used: 0x%llx\n", in i40e_parse_cls_flower()
8598 dev_err(&pf->pdev->dev, "Bad ether dest mask %pM\n", in i40e_parse_cls_flower()
8608 dev_err(&pf->pdev->dev, "Bad ether src mask %pM\n", in i40e_parse_cls_flower()
8626 dev_err(&pf->pdev->dev, "Bad vlan mask 0x%04x\n", in i40e_parse_cls_flower()
8650 dev_err(&pf->pdev->dev, "Bad ip dst mask %pI4b\n", in i40e_parse_cls_flower()
8660 dev_err(&pf->pdev->dev, "Bad ip src mask %pI4b\n", in i40e_parse_cls_flower()
8667 dev_err(&pf->pdev->dev, "Tenant id not allowed for ip filter\n"); in i40e_parse_cls_flower()
8684 dev_err(&pf->pdev->dev, in i40e_parse_cls_flower()
8706 dev_err(&pf->pdev->dev, "Bad src port mask 0x%04x\n", in i40e_parse_cls_flower()
8716 dev_err(&pf->pdev->dev, "Bad dst port mask 0x%04x\n", in i40e_parse_cls_flower()
8730 dev_err(&pf->pdev->dev, in i40e_parse_cls_flower()
8785 struct i40e_pf *pf = vsi->back; in i40e_configure_clsflower() local
8794 dev_err(&pf->pdev->dev, "Unable to add filter because of invalid destination"); in i40e_configure_clsflower()
8798 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) || in i40e_configure_clsflower()
8799 test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) in i40e_configure_clsflower()
8802 if (pf->fdir_pf_active_filters || in i40e_configure_clsflower()
8803 (!hlist_empty(&pf->fdir_filter_list))) { in i40e_configure_clsflower()
8837 dev_err(&pf->pdev->dev, "Failed to add cloud filter, err %d\n", in i40e_configure_clsflower()
8845 hlist_add_head(&filter->cloud_node, &pf->cloud_filter_list); in i40e_configure_clsflower()
8847 pf->num_cloud_filters++; in i40e_configure_clsflower()
8884 struct i40e_pf *pf = vsi->back; in i40e_delete_clsflower() local
8901 dev_err(&pf->pdev->dev, in i40e_delete_clsflower()
8904 return i40e_aq_rc_to_posix(err, pf->hw.aq.asq_last_status); in i40e_delete_clsflower()
8907 pf->num_cloud_filters--; in i40e_delete_clsflower()
8908 if (!pf->num_cloud_filters) in i40e_delete_clsflower()
8909 if ((pf->flags & I40E_FLAG_FD_SB_TO_CLOUD_FILTER) && in i40e_delete_clsflower()
8910 !(pf->flags & I40E_FLAG_FD_SB_INACTIVE)) { in i40e_delete_clsflower()
8911 pf->flags |= I40E_FLAG_FD_SB_ENABLED; in i40e_delete_clsflower()
8912 pf->flags &= ~I40E_FLAG_FD_SB_TO_CLOUD_FILTER; in i40e_delete_clsflower()
8913 pf->flags &= ~I40E_FLAG_FD_SB_INACTIVE; in i40e_delete_clsflower()
8993 struct i40e_pf *pf = vsi->back; in i40e_open() local
8997 if (test_bit(__I40E_TESTING, pf->state) || in i40e_open()
8998 test_bit(__I40E_BAD_EEPROM, pf->state)) in i40e_open()
9003 if (i40e_force_link_state(pf, true)) in i40e_open()
9011 wr32(&pf->hw, I40E_GLLAN_TSOMSK_F, be32_to_cpu(TCP_FLAG_PSH | in i40e_open()
9013 wr32(&pf->hw, I40E_GLLAN_TSOMSK_M, be32_to_cpu(TCP_FLAG_PSH | in i40e_open()
9016 wr32(&pf->hw, I40E_GLLAN_TSOMSK_L, be32_to_cpu(TCP_FLAG_CWR) >> 16); in i40e_open()
9055 struct i40e_pf *pf = vsi->back; in i40e_vsi_open() local
9073 dev_driver_string(&pf->pdev->dev), vsi->netdev->name); in i40e_vsi_open()
9085 dev_driver_string(&pf->pdev->dev), in i40e_vsi_open()
9086 dev_name(&pf->pdev->dev)); in i40e_vsi_open()
9110 if (vsi == pf->vsi[pf->lan_vsi]) in i40e_vsi_open()
9111 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_vsi_open()
9123 static void i40e_fdir_filter_exit(struct i40e_pf *pf) in i40e_fdir_filter_exit() argument
9130 &pf->fdir_filter_list, fdir_node) { in i40e_fdir_filter_exit()
9135 list_for_each_entry_safe(pit_entry, tmp, &pf->l3_flex_pit_list, list) { in i40e_fdir_filter_exit()
9139 INIT_LIST_HEAD(&pf->l3_flex_pit_list); in i40e_fdir_filter_exit()
9141 list_for_each_entry_safe(pit_entry, tmp, &pf->l4_flex_pit_list, list) { in i40e_fdir_filter_exit()
9145 INIT_LIST_HEAD(&pf->l4_flex_pit_list); in i40e_fdir_filter_exit()
9147 pf->fdir_pf_active_filters = 0; in i40e_fdir_filter_exit()
9148 i40e_reset_fdir_filter_cnt(pf); in i40e_fdir_filter_exit()
9151 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_TCP, in i40e_fdir_filter_exit()
9156 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_TCP, in i40e_fdir_filter_exit()
9161 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_UDP, in i40e_fdir_filter_exit()
9166 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_UDP, in i40e_fdir_filter_exit()
9171 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_SCTP, in i40e_fdir_filter_exit()
9176 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_SCTP, in i40e_fdir_filter_exit()
9181 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_OTHER, in i40e_fdir_filter_exit()
9184 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV4, in i40e_fdir_filter_exit()
9188 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_OTHER, in i40e_fdir_filter_exit()
9191 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV6, in i40e_fdir_filter_exit()
9202 static void i40e_cloud_filter_exit(struct i40e_pf *pf) in i40e_cloud_filter_exit() argument
9208 &pf->cloud_filter_list, cloud_node) { in i40e_cloud_filter_exit()
9212 pf->num_cloud_filters = 0; in i40e_cloud_filter_exit()
9214 if ((pf->flags & I40E_FLAG_FD_SB_TO_CLOUD_FILTER) && in i40e_cloud_filter_exit()
9215 !(pf->flags & I40E_FLAG_FD_SB_INACTIVE)) { in i40e_cloud_filter_exit()
9216 pf->flags |= I40E_FLAG_FD_SB_ENABLED; in i40e_cloud_filter_exit()
9217 pf->flags &= ~I40E_FLAG_FD_SB_TO_CLOUD_FILTER; in i40e_cloud_filter_exit()
9218 pf->flags &= ~I40E_FLAG_FD_SB_INACTIVE; in i40e_cloud_filter_exit()
9253 void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags, bool lock_acquired) in i40e_do_reset() argument
9268 dev_dbg(&pf->pdev->dev, "GlobalR requested\n"); in i40e_do_reset()
9269 val = rd32(&pf->hw, I40E_GLGEN_RTRIG); in i40e_do_reset()
9271 wr32(&pf->hw, I40E_GLGEN_RTRIG, val); in i40e_do_reset()
9279 dev_dbg(&pf->pdev->dev, "CoreR requested\n"); in i40e_do_reset()
9280 val = rd32(&pf->hw, I40E_GLGEN_RTRIG); in i40e_do_reset()
9282 wr32(&pf->hw, I40E_GLGEN_RTRIG, val); in i40e_do_reset()
9283 i40e_flush(&pf->hw); in i40e_do_reset()
9295 dev_dbg(&pf->pdev->dev, "PFR requested\n"); in i40e_do_reset()
9296 i40e_handle_reset_warning(pf, lock_acquired); in i40e_do_reset()
9303 i40e_prep_for_reset(pf); in i40e_do_reset()
9304 i40e_reset_and_rebuild(pf, true, lock_acquired); in i40e_do_reset()
9305 dev_info(&pf->pdev->dev, in i40e_do_reset()
9306 pf->flags & I40E_FLAG_DISABLE_FW_LLDP ? in i40e_do_reset()
9314 dev_info(&pf->pdev->dev, in i40e_do_reset()
9316 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_do_reset()
9317 struct i40e_vsi *vsi = pf->vsi[v]; in i40e_do_reset()
9322 i40e_vsi_reinit_locked(pf->vsi[v]); in i40e_do_reset()
9328 dev_info(&pf->pdev->dev, "VSI down requested\n"); in i40e_do_reset()
9329 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_do_reset()
9330 struct i40e_vsi *vsi = pf->vsi[v]; in i40e_do_reset()
9340 dev_info(&pf->pdev->dev, in i40e_do_reset()
9352 bool i40e_dcb_need_reconfig(struct i40e_pf *pf, in i40e_dcb_need_reconfig() argument
9367 dev_dbg(&pf->pdev->dev, "ETS UP2TC changed.\n"); in i40e_dcb_need_reconfig()
9373 dev_dbg(&pf->pdev->dev, "ETS TC BW Table changed.\n"); in i40e_dcb_need_reconfig()
9378 dev_dbg(&pf->pdev->dev, "ETS TSA Table changed.\n"); in i40e_dcb_need_reconfig()
9386 dev_dbg(&pf->pdev->dev, "PFC config change detected.\n"); in i40e_dcb_need_reconfig()
9394 dev_dbg(&pf->pdev->dev, "APP Table change detected.\n"); in i40e_dcb_need_reconfig()
9397 dev_dbg(&pf->pdev->dev, "dcb need_reconfig=%d\n", need_reconfig); in i40e_dcb_need_reconfig()
9406 static int i40e_handle_lldp_event(struct i40e_pf *pf, in i40e_handle_lldp_event() argument
9411 struct i40e_hw *hw = &pf->hw; in i40e_handle_lldp_event()
9421 !(pf->flags & I40E_FLAG_DCB_CAPABLE)) in i40e_handle_lldp_event()
9423 pf->flags |= I40E_FLAG_DCB_CAPABLE; in i40e_handle_lldp_event()
9426 if (!(pf->flags & I40E_FLAG_DCB_CAPABLE)) in i40e_handle_lldp_event()
9432 dev_dbg(&pf->pdev->dev, "LLDP event mib bridge type 0x%x\n", type); in i40e_handle_lldp_event()
9438 dev_dbg(&pf->pdev->dev, in i40e_handle_lldp_event()
9454 ret = i40e_get_dcb_config(&pf->hw); in i40e_handle_lldp_event()
9460 dev_warn(&pf->pdev->dev, in i40e_handle_lldp_event()
9462 pf->flags &= ~I40E_FLAG_DCB_CAPABLE; in i40e_handle_lldp_event()
9464 dev_info(&pf->pdev->dev, in i40e_handle_lldp_event()
9467 i40e_aq_str(&pf->hw, in i40e_handle_lldp_event()
9468 pf->hw.aq.asq_last_status)); in i40e_handle_lldp_event()
9476 dev_dbg(&pf->pdev->dev, "No change detected in DCBX configuration.\n"); in i40e_handle_lldp_event()
9480 need_reconfig = i40e_dcb_need_reconfig(pf, &tmp_dcbx_cfg, in i40e_handle_lldp_event()
9483 i40e_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &hw->local_dcbx_config); in i40e_handle_lldp_event()
9490 pf->flags |= I40E_FLAG_DCB_ENABLED; in i40e_handle_lldp_event()
9492 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_handle_lldp_event()
9494 set_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_handle_lldp_event()
9496 i40e_pf_quiesce_all_vsi(pf); in i40e_handle_lldp_event()
9499 i40e_dcb_reconfigure(pf); in i40e_handle_lldp_event()
9501 ret = i40e_resume_port_tx(pf); in i40e_handle_lldp_event()
9503 clear_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_handle_lldp_event()
9509 ret = i40e_pf_wait_queues_disabled(pf); in i40e_handle_lldp_event()
9512 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_handle_lldp_event()
9513 i40e_service_event_schedule(pf); in i40e_handle_lldp_event()
9515 i40e_pf_unquiesce_all_vsi(pf); in i40e_handle_lldp_event()
9516 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_handle_lldp_event()
9517 set_bit(__I40E_CLIENT_L2_CHANGE, pf->state); in i40e_handle_lldp_event()
9531 void i40e_do_reset_safe(struct i40e_pf *pf, u32 reset_flags) in i40e_do_reset_safe() argument
9534 i40e_do_reset(pf, reset_flags, true); in i40e_do_reset_safe()
9546 static void i40e_handle_lan_overflow_event(struct i40e_pf *pf, in i40e_handle_lan_overflow_event() argument
9553 struct i40e_hw *hw = &pf->hw; in i40e_handle_lan_overflow_event()
9557 dev_dbg(&pf->pdev->dev, "overflow Rx Queue Number = %d QTX_CTL=0x%08x\n", in i40e_handle_lan_overflow_event()
9566 vf = &pf->vf[vf_id]; in i40e_handle_lan_overflow_event()
9578 u32 i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf) in i40e_get_cur_guaranteed_fd_count() argument
9582 val = rd32(&pf->hw, I40E_PFQF_FDSTAT); in i40e_get_cur_guaranteed_fd_count()
9591 u32 i40e_get_current_fd_count(struct i40e_pf *pf) in i40e_get_current_fd_count() argument
9595 val = rd32(&pf->hw, I40E_PFQF_FDSTAT); in i40e_get_current_fd_count()
9606 u32 i40e_get_global_fd_count(struct i40e_pf *pf) in i40e_get_global_fd_count() argument
9610 val = rd32(&pf->hw, I40E_GLQF_FDCNT_0); in i40e_get_global_fd_count()
9621 static void i40e_reenable_fdir_sb(struct i40e_pf *pf) in i40e_reenable_fdir_sb() argument
9623 if (test_and_clear_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state)) in i40e_reenable_fdir_sb()
9624 if ((pf->flags & I40E_FLAG_FD_SB_ENABLED) && in i40e_reenable_fdir_sb()
9625 (I40E_DEBUG_FD & pf->hw.debug_mask)) in i40e_reenable_fdir_sb()
9626 …dev_info(&pf->pdev->dev, "FD Sideband/ntuple is being enabled since we have space in the table now… in i40e_reenable_fdir_sb()
9633 static void i40e_reenable_fdir_atr(struct i40e_pf *pf) in i40e_reenable_fdir_atr() argument
9635 if (test_and_clear_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state)) { in i40e_reenable_fdir_atr()
9641 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_TCP, in i40e_reenable_fdir_atr()
9645 if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) && in i40e_reenable_fdir_atr()
9646 (I40E_DEBUG_FD & pf->hw.debug_mask)) in i40e_reenable_fdir_atr()
9647 …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()
9656 static void i40e_delete_invalid_filter(struct i40e_pf *pf, in i40e_delete_invalid_filter() argument
9660 pf->fdir_pf_active_filters--; in i40e_delete_invalid_filter()
9661 pf->fd_inv = 0; in i40e_delete_invalid_filter()
9665 pf->fd_tcp4_filter_cnt--; in i40e_delete_invalid_filter()
9668 pf->fd_udp4_filter_cnt--; in i40e_delete_invalid_filter()
9671 pf->fd_sctp4_filter_cnt--; in i40e_delete_invalid_filter()
9674 pf->fd_tcp6_filter_cnt--; in i40e_delete_invalid_filter()
9677 pf->fd_udp6_filter_cnt--; in i40e_delete_invalid_filter()
9680 pf->fd_udp6_filter_cnt--; in i40e_delete_invalid_filter()
9685 pf->fd_tcp4_filter_cnt--; in i40e_delete_invalid_filter()
9688 pf->fd_udp4_filter_cnt--; in i40e_delete_invalid_filter()
9691 pf->fd_sctp4_filter_cnt--; in i40e_delete_invalid_filter()
9694 pf->fd_ip4_filter_cnt--; in i40e_delete_invalid_filter()
9701 pf->fd_tcp6_filter_cnt--; in i40e_delete_invalid_filter()
9704 pf->fd_udp6_filter_cnt--; in i40e_delete_invalid_filter()
9707 pf->fd_sctp6_filter_cnt--; in i40e_delete_invalid_filter()
9710 pf->fd_ip6_filter_cnt--; in i40e_delete_invalid_filter()
9725 void i40e_fdir_check_and_reenable(struct i40e_pf *pf) in i40e_fdir_check_and_reenable() argument
9731 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state)) in i40e_fdir_check_and_reenable()
9735 fcnt_prog = i40e_get_global_fd_count(pf); in i40e_fdir_check_and_reenable()
9736 fcnt_avail = pf->fdir_pf_filter_count; in i40e_fdir_check_and_reenable()
9738 (pf->fd_add_err == 0) || in i40e_fdir_check_and_reenable()
9739 (i40e_get_current_atr_cnt(pf) < pf->fd_atr_cnt)) in i40e_fdir_check_and_reenable()
9740 i40e_reenable_fdir_sb(pf); in i40e_fdir_check_and_reenable()
9747 pf->fd_tcp4_filter_cnt == 0 && pf->fd_tcp6_filter_cnt == 0) in i40e_fdir_check_and_reenable()
9748 i40e_reenable_fdir_atr(pf); in i40e_fdir_check_and_reenable()
9751 if (pf->fd_inv > 0) { in i40e_fdir_check_and_reenable()
9753 &pf->fdir_filter_list, fdir_node) in i40e_fdir_check_and_reenable()
9754 if (filter->fd_id == pf->fd_inv) in i40e_fdir_check_and_reenable()
9755 i40e_delete_invalid_filter(pf, filter); in i40e_fdir_check_and_reenable()
9765 static void i40e_fdir_flush_and_replay(struct i40e_pf *pf) in i40e_fdir_flush_and_replay() argument
9773 if (!time_after(jiffies, pf->fd_flush_timestamp + in i40e_fdir_flush_and_replay()
9780 min_flush_time = pf->fd_flush_timestamp + in i40e_fdir_flush_and_replay()
9782 fd_room = pf->fdir_pf_filter_count - pf->fdir_pf_active_filters; in i40e_fdir_flush_and_replay()
9786 if (I40E_DEBUG_FD & pf->hw.debug_mask) in i40e_fdir_flush_and_replay()
9787 dev_info(&pf->pdev->dev, "ATR disabled, not enough FD filter space.\n"); in i40e_fdir_flush_and_replay()
9791 pf->fd_flush_timestamp = jiffies; in i40e_fdir_flush_and_replay()
9792 set_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state); in i40e_fdir_flush_and_replay()
9794 wr32(&pf->hw, I40E_PFQF_CTL_1, in i40e_fdir_flush_and_replay()
9796 i40e_flush(&pf->hw); in i40e_fdir_flush_and_replay()
9797 pf->fd_flush_cnt++; in i40e_fdir_flush_and_replay()
9798 pf->fd_add_err = 0; in i40e_fdir_flush_and_replay()
9802 reg = rd32(&pf->hw, I40E_PFQF_CTL_1); in i40e_fdir_flush_and_replay()
9807 dev_warn(&pf->pdev->dev, "FD table did not flush, needs more time\n"); in i40e_fdir_flush_and_replay()
9810 i40e_fdir_filter_restore(pf->vsi[pf->lan_vsi]); in i40e_fdir_flush_and_replay()
9811 if (!disable_atr && !pf->fd_tcp4_filter_cnt) in i40e_fdir_flush_and_replay()
9812 clear_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state); in i40e_fdir_flush_and_replay()
9813 clear_bit(__I40E_FD_FLUSH_REQUESTED, pf->state); in i40e_fdir_flush_and_replay()
9814 if (I40E_DEBUG_FD & pf->hw.debug_mask) in i40e_fdir_flush_and_replay()
9815 dev_info(&pf->pdev->dev, "FD Filter table flushed and FD-SB replayed.\n"); in i40e_fdir_flush_and_replay()
9823 u32 i40e_get_current_atr_cnt(struct i40e_pf *pf) in i40e_get_current_atr_cnt() argument
9825 return i40e_get_current_fd_count(pf) - pf->fdir_pf_active_filters; in i40e_get_current_atr_cnt()
9832 static void i40e_fdir_reinit_subtask(struct i40e_pf *pf) in i40e_fdir_reinit_subtask() argument
9836 if (test_bit(__I40E_DOWN, pf->state)) in i40e_fdir_reinit_subtask()
9839 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state)) in i40e_fdir_reinit_subtask()
9840 i40e_fdir_flush_and_replay(pf); in i40e_fdir_reinit_subtask()
9842 i40e_fdir_check_and_reenable(pf); in i40e_fdir_reinit_subtask()
9888 struct i40e_pf *pf; in i40e_veb_link_event() local
9891 if (!veb || !veb->pf) in i40e_veb_link_event()
9893 pf = veb->pf; in i40e_veb_link_event()
9897 if (pf->veb[i] && (pf->veb[i]->uplink_seid == veb->seid)) in i40e_veb_link_event()
9898 i40e_veb_link_event(pf->veb[i], link_up); in i40e_veb_link_event()
9901 for (i = 0; i < pf->num_alloc_vsi; i++) in i40e_veb_link_event()
9902 if (pf->vsi[i] && (pf->vsi[i]->uplink_seid == veb->seid)) in i40e_veb_link_event()
9903 i40e_vsi_link_event(pf->vsi[i], link_up); in i40e_veb_link_event()
9910 static void i40e_link_event(struct i40e_pf *pf) in i40e_link_event() argument
9912 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_link_event()
9921 pf->hw.phy.get_link_info = true; in i40e_link_event()
9922 old_link = (pf->hw.phy.link_info_old.link_info & I40E_AQ_LINK_UP); in i40e_link_event()
9923 status = i40e_get_link_status(&pf->hw, &new_link); in i40e_link_event()
9927 clear_bit(__I40E_TEMP_LINK_POLLING, pf->state); in i40e_link_event()
9932 set_bit(__I40E_TEMP_LINK_POLLING, pf->state); in i40e_link_event()
9933 dev_dbg(&pf->pdev->dev, "couldn't get link state, status: %d\n", in i40e_link_event()
9938 old_link_speed = pf->hw.phy.link_info_old.link_speed; in i40e_link_event()
9939 new_link_speed = pf->hw.phy.link_info.link_speed; in i40e_link_event()
9952 if (pf->lan_veb < I40E_MAX_VEB && pf->veb[pf->lan_veb]) in i40e_link_event()
9953 i40e_veb_link_event(pf->veb[pf->lan_veb], new_link); in i40e_link_event()
9957 if (pf->vf) in i40e_link_event()
9958 i40e_vc_notify_link_state(pf); in i40e_link_event()
9960 if (pf->flags & I40E_FLAG_PTP) in i40e_link_event()
9961 i40e_ptp_set_increment(pf); in i40e_link_event()
9966 if (pf->dcbx_cap & DCB_CAP_DCBX_LLD_MANAGED) in i40e_link_event()
9973 dev_dbg(&pf->pdev->dev, "Reconfig DCB to single TC as result of Link Down\n"); in i40e_link_event()
9974 memset(&pf->tmp_cfg, 0, sizeof(pf->tmp_cfg)); in i40e_link_event()
9975 err = i40e_dcb_sw_default_config(pf); in i40e_link_event()
9977 pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | in i40e_link_event()
9980 pf->dcbx_cap = DCB_CAP_DCBX_HOST | in i40e_link_event()
9982 pf->flags |= I40E_FLAG_DCB_CAPABLE; in i40e_link_event()
9983 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_link_event()
9993 static void i40e_watchdog_subtask(struct i40e_pf *pf) in i40e_watchdog_subtask() argument
9998 if (test_bit(__I40E_DOWN, pf->state) || in i40e_watchdog_subtask()
9999 test_bit(__I40E_CONFIG_BUSY, pf->state)) in i40e_watchdog_subtask()
10003 if (time_before(jiffies, (pf->service_timer_previous + in i40e_watchdog_subtask()
10004 pf->service_timer_period))) in i40e_watchdog_subtask()
10006 pf->service_timer_previous = jiffies; in i40e_watchdog_subtask()
10008 if ((pf->flags & I40E_FLAG_LINK_POLLING_ENABLED) || in i40e_watchdog_subtask()
10009 test_bit(__I40E_TEMP_LINK_POLLING, pf->state)) in i40e_watchdog_subtask()
10010 i40e_link_event(pf); in i40e_watchdog_subtask()
10015 for (i = 0; i < pf->num_alloc_vsi; i++) in i40e_watchdog_subtask()
10016 if (pf->vsi[i] && pf->vsi[i]->netdev) in i40e_watchdog_subtask()
10017 i40e_update_stats(pf->vsi[i]); in i40e_watchdog_subtask()
10019 if (pf->flags & I40E_FLAG_VEB_STATS_ENABLED) { in i40e_watchdog_subtask()
10022 if (pf->veb[i]) in i40e_watchdog_subtask()
10023 i40e_update_veb_stats(pf->veb[i]); in i40e_watchdog_subtask()
10026 i40e_ptp_rx_hang(pf); in i40e_watchdog_subtask()
10027 i40e_ptp_tx_hang(pf); in i40e_watchdog_subtask()
10034 static void i40e_reset_subtask(struct i40e_pf *pf) in i40e_reset_subtask() argument
10038 if (test_bit(__I40E_REINIT_REQUESTED, pf->state)) { in i40e_reset_subtask()
10040 clear_bit(__I40E_REINIT_REQUESTED, pf->state); in i40e_reset_subtask()
10042 if (test_bit(__I40E_PF_RESET_REQUESTED, pf->state)) { in i40e_reset_subtask()
10044 clear_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_reset_subtask()
10046 if (test_bit(__I40E_CORE_RESET_REQUESTED, pf->state)) { in i40e_reset_subtask()
10048 clear_bit(__I40E_CORE_RESET_REQUESTED, pf->state); in i40e_reset_subtask()
10050 if (test_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state)) { in i40e_reset_subtask()
10052 clear_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state); in i40e_reset_subtask()
10054 if (test_bit(__I40E_DOWN_REQUESTED, pf->state)) { in i40e_reset_subtask()
10056 clear_bit(__I40E_DOWN_REQUESTED, pf->state); in i40e_reset_subtask()
10062 if (test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) { in i40e_reset_subtask()
10063 i40e_prep_for_reset(pf); in i40e_reset_subtask()
10064 i40e_reset(pf); in i40e_reset_subtask()
10065 i40e_rebuild(pf, false, false); in i40e_reset_subtask()
10070 !test_bit(__I40E_DOWN, pf->state) && in i40e_reset_subtask()
10071 !test_bit(__I40E_CONFIG_BUSY, pf->state)) { in i40e_reset_subtask()
10072 i40e_do_reset(pf, reset_flags, false); in i40e_reset_subtask()
10081 static void i40e_handle_link_event(struct i40e_pf *pf, in i40e_handle_link_event() argument
10093 i40e_link_event(pf); in i40e_handle_link_event()
10097 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
10099 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
10108 (!(pf->flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED))) { in i40e_handle_link_event()
10109 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
10111 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
10121 static void i40e_clean_adminq_subtask(struct i40e_pf *pf) in i40e_clean_adminq_subtask() argument
10124 struct i40e_hw *hw = &pf->hw; in i40e_clean_adminq_subtask()
10132 if (test_bit(__I40E_RESET_FAILED, pf->state)) in i40e_clean_adminq_subtask()
10136 val = rd32(&pf->hw, pf->hw.aq.arq.len); in i40e_clean_adminq_subtask()
10140 dev_info(&pf->pdev->dev, "ARQ VF Error detected\n"); in i40e_clean_adminq_subtask()
10145 dev_info(&pf->pdev->dev, "ARQ Overflow Error detected\n"); in i40e_clean_adminq_subtask()
10147 pf->arq_overflows++; in i40e_clean_adminq_subtask()
10151 dev_info(&pf->pdev->dev, "ARQ Critical Error detected\n"); in i40e_clean_adminq_subtask()
10155 wr32(&pf->hw, pf->hw.aq.arq.len, val); in i40e_clean_adminq_subtask()
10157 val = rd32(&pf->hw, pf->hw.aq.asq.len); in i40e_clean_adminq_subtask()
10160 if (pf->hw.debug_mask & I40E_DEBUG_AQ) in i40e_clean_adminq_subtask()
10161 dev_info(&pf->pdev->dev, "ASQ VF Error detected\n"); in i40e_clean_adminq_subtask()
10165 if (pf->hw.debug_mask & I40E_DEBUG_AQ) in i40e_clean_adminq_subtask()
10166 dev_info(&pf->pdev->dev, "ASQ Overflow Error detected\n"); in i40e_clean_adminq_subtask()
10170 if (pf->hw.debug_mask & I40E_DEBUG_AQ) in i40e_clean_adminq_subtask()
10171 dev_info(&pf->pdev->dev, "ASQ Critical Error detected\n"); in i40e_clean_adminq_subtask()
10175 wr32(&pf->hw, pf->hw.aq.asq.len, val); in i40e_clean_adminq_subtask()
10187 dev_info(&pf->pdev->dev, "ARQ event error %d\n", ret); in i40e_clean_adminq_subtask()
10196 i40e_handle_link_event(pf, &event); in i40e_clean_adminq_subtask()
10200 ret = i40e_vc_process_vf_msg(pf, in i40e_clean_adminq_subtask()
10208 dev_dbg(&pf->pdev->dev, "ARQ: Update LLDP MIB event received\n"); in i40e_clean_adminq_subtask()
10211 i40e_handle_lldp_event(pf, &event); in i40e_clean_adminq_subtask()
10216 dev_dbg(&pf->pdev->dev, "ARQ LAN queue overflow event received\n"); in i40e_clean_adminq_subtask()
10217 i40e_handle_lan_overflow_event(pf, &event); in i40e_clean_adminq_subtask()
10220 dev_info(&pf->pdev->dev, "ARQ: Msg from other pf\n"); in i40e_clean_adminq_subtask()
10225 i40e_debug(&pf->hw, I40E_DEBUG_NVM, in i40e_clean_adminq_subtask()
10230 dev_info(&pf->pdev->dev, in i40e_clean_adminq_subtask()
10235 } while (i++ < pf->adminq_work_limit); in i40e_clean_adminq_subtask()
10237 if (i < pf->adminq_work_limit) in i40e_clean_adminq_subtask()
10238 clear_bit(__I40E_ADMINQ_EVENT_PENDING, pf->state); in i40e_clean_adminq_subtask()
10253 static void i40e_verify_eeprom(struct i40e_pf *pf) in i40e_verify_eeprom() argument
10257 err = i40e_diag_eeprom_test(&pf->hw); in i40e_verify_eeprom()
10260 err = i40e_diag_eeprom_test(&pf->hw); in i40e_verify_eeprom()
10262 dev_info(&pf->pdev->dev, "eeprom check failed (%d), Tx/Rx traffic disabled\n", in i40e_verify_eeprom()
10264 set_bit(__I40E_BAD_EEPROM, pf->state); in i40e_verify_eeprom()
10268 if (!err && test_bit(__I40E_BAD_EEPROM, pf->state)) { in i40e_verify_eeprom()
10269 dev_info(&pf->pdev->dev, "eeprom check passed, Tx/Rx traffic enabled\n"); in i40e_verify_eeprom()
10270 clear_bit(__I40E_BAD_EEPROM, pf->state); in i40e_verify_eeprom()
10280 static void i40e_enable_pf_switch_lb(struct i40e_pf *pf) in i40e_enable_pf_switch_lb() argument
10282 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_enable_pf_switch_lb()
10286 ctxt.seid = pf->main_vsi_seid; in i40e_enable_pf_switch_lb()
10287 ctxt.pf_num = pf->hw.pf_id; in i40e_enable_pf_switch_lb()
10289 ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); in i40e_enable_pf_switch_lb()
10291 dev_info(&pf->pdev->dev, in i40e_enable_pf_switch_lb()
10294 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_enable_pf_switch_lb()
10303 dev_info(&pf->pdev->dev, in i40e_enable_pf_switch_lb()
10306 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_enable_pf_switch_lb()
10316 static void i40e_disable_pf_switch_lb(struct i40e_pf *pf) in i40e_disable_pf_switch_lb() argument
10318 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_disable_pf_switch_lb()
10322 ctxt.seid = pf->main_vsi_seid; in i40e_disable_pf_switch_lb()
10323 ctxt.pf_num = pf->hw.pf_id; in i40e_disable_pf_switch_lb()
10325 ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); in i40e_disable_pf_switch_lb()
10327 dev_info(&pf->pdev->dev, in i40e_disable_pf_switch_lb()
10330 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_disable_pf_switch_lb()
10339 dev_info(&pf->pdev->dev, in i40e_disable_pf_switch_lb()
10342 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_disable_pf_switch_lb()
10356 struct i40e_pf *pf = veb->pf; in i40e_config_bridge_mode() local
10358 if (pf->hw.debug_mask & I40E_DEBUG_LAN) in i40e_config_bridge_mode()
10359 dev_info(&pf->pdev->dev, "enabling bridge mode: %s\n", in i40e_config_bridge_mode()
10362 i40e_disable_pf_switch_lb(pf); in i40e_config_bridge_mode()
10364 i40e_enable_pf_switch_lb(pf); in i40e_config_bridge_mode()
10379 struct i40e_pf *pf = veb->pf; in i40e_reconstitute_veb() local
10384 for (v = 0; v < pf->num_alloc_vsi && !ctl_vsi; v++) { in i40e_reconstitute_veb()
10385 if (pf->vsi[v] && in i40e_reconstitute_veb()
10386 pf->vsi[v]->veb_idx == veb->idx && in i40e_reconstitute_veb()
10387 pf->vsi[v]->flags & I40E_VSI_FLAG_VEB_OWNER) { in i40e_reconstitute_veb()
10388 ctl_vsi = pf->vsi[v]; in i40e_reconstitute_veb()
10393 dev_info(&pf->pdev->dev, in i40e_reconstitute_veb()
10398 if (ctl_vsi != pf->vsi[pf->lan_vsi]) in i40e_reconstitute_veb()
10399 ctl_vsi->uplink_seid = pf->vsi[pf->lan_vsi]->uplink_seid; in i40e_reconstitute_veb()
10402 dev_info(&pf->pdev->dev, in i40e_reconstitute_veb()
10414 if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED) in i40e_reconstitute_veb()
10421 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_reconstitute_veb()
10422 if (!pf->vsi[v] || pf->vsi[v] == ctl_vsi) in i40e_reconstitute_veb()
10425 if (pf->vsi[v]->veb_idx == veb->idx) { in i40e_reconstitute_veb()
10426 struct i40e_vsi *vsi = pf->vsi[v]; in i40e_reconstitute_veb()
10431 dev_info(&pf->pdev->dev, in i40e_reconstitute_veb()
10442 if (pf->veb[veb_idx] && pf->veb[veb_idx]->veb_idx == veb->idx) { in i40e_reconstitute_veb()
10443 pf->veb[veb_idx]->uplink_seid = veb->seid; in i40e_reconstitute_veb()
10444 ret = i40e_reconstitute_veb(pf->veb[veb_idx]); in i40e_reconstitute_veb()
10459 static int i40e_get_capabilities(struct i40e_pf *pf, in i40e_get_capabilities() argument
10474 err = i40e_aq_discover_capabilities(&pf->hw, cap_buf, buf_len, in i40e_get_capabilities()
10480 if (pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) { in i40e_get_capabilities()
10483 } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK || err) { in i40e_get_capabilities()
10484 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10487 i40e_aq_str(&pf->hw, in i40e_get_capabilities()
10488 pf->hw.aq.asq_last_status)); in i40e_get_capabilities()
10493 if (pf->hw.debug_mask & I40E_DEBUG_USER) { in i40e_get_capabilities()
10495 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10497 pf->hw.pf_id, pf->hw.func_caps.num_vfs, in i40e_get_capabilities()
10498 pf->hw.func_caps.num_msix_vectors, in i40e_get_capabilities()
10499 pf->hw.func_caps.num_msix_vectors_vf, in i40e_get_capabilities()
10500 pf->hw.func_caps.fd_filters_guaranteed, in i40e_get_capabilities()
10501 pf->hw.func_caps.fd_filters_best_effort, in i40e_get_capabilities()
10502 pf->hw.func_caps.num_tx_qp, in i40e_get_capabilities()
10503 pf->hw.func_caps.num_vsis); in i40e_get_capabilities()
10505 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10507 pf->hw.dev_caps.switch_mode, in i40e_get_capabilities()
10508 pf->hw.dev_caps.valid_functions); in i40e_get_capabilities()
10509 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10511 pf->hw.dev_caps.sr_iov_1_1, in i40e_get_capabilities()
10512 pf->hw.dev_caps.num_vfs); in i40e_get_capabilities()
10513 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10515 pf->hw.dev_caps.num_vsis, in i40e_get_capabilities()
10516 pf->hw.dev_caps.num_rx_qp, in i40e_get_capabilities()
10517 pf->hw.dev_caps.num_tx_qp); in i40e_get_capabilities()
10521 #define DEF_NUM_VSI (1 + (pf->hw.func_caps.fcoe ? 1 : 0) \ in i40e_get_capabilities()
10522 + pf->hw.func_caps.num_vfs) in i40e_get_capabilities()
10523 if (pf->hw.revision_id == 0 && in i40e_get_capabilities()
10524 pf->hw.func_caps.num_vsis < DEF_NUM_VSI) { in i40e_get_capabilities()
10525 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10527 pf->hw.func_caps.num_vsis, DEF_NUM_VSI); in i40e_get_capabilities()
10528 pf->hw.func_caps.num_vsis = DEF_NUM_VSI; in i40e_get_capabilities()
10540 static void i40e_fdir_sb_setup(struct i40e_pf *pf) in i40e_fdir_sb_setup() argument
10547 if (!rd32(&pf->hw, I40E_GLQF_HKEY(0))) { in i40e_fdir_sb_setup()
10556 wr32(&pf->hw, I40E_GLQF_HKEY(i), hkey[i]); in i40e_fdir_sb_setup()
10559 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) in i40e_fdir_sb_setup()
10563 vsi = i40e_find_vsi_by_type(pf, I40E_VSI_FDIR); in i40e_fdir_sb_setup()
10567 vsi = i40e_vsi_setup(pf, I40E_VSI_FDIR, in i40e_fdir_sb_setup()
10568 pf->vsi[pf->lan_vsi]->seid, 0); in i40e_fdir_sb_setup()
10570 dev_info(&pf->pdev->dev, "Couldn't create FDir VSI\n"); in i40e_fdir_sb_setup()
10571 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; in i40e_fdir_sb_setup()
10572 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_fdir_sb_setup()
10584 static void i40e_fdir_teardown(struct i40e_pf *pf) in i40e_fdir_teardown() argument
10588 i40e_fdir_filter_exit(pf); in i40e_fdir_teardown()
10589 vsi = i40e_find_vsi_by_type(pf, I40E_VSI_FDIR); in i40e_fdir_teardown()
10605 struct i40e_pf *pf = vsi->back; in i40e_rebuild_cloud_filters() local
10610 hlist_for_each_entry_safe(cfilter, node, &pf->cloud_filter_list, in i40e_rebuild_cloud_filters()
10622 dev_dbg(&pf->pdev->dev, in i40e_rebuild_cloud_filters()
10625 i40e_aq_str(&pf->hw, in i40e_rebuild_cloud_filters()
10626 pf->hw.aq.asq_last_status)); in i40e_rebuild_cloud_filters()
10715 static void i40e_prep_for_reset(struct i40e_pf *pf) in i40e_prep_for_reset() argument
10717 struct i40e_hw *hw = &pf->hw; in i40e_prep_for_reset()
10721 clear_bit(__I40E_RESET_INTR_RECEIVED, pf->state); in i40e_prep_for_reset()
10722 if (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_prep_for_reset()
10724 if (i40e_check_asq_alive(&pf->hw)) in i40e_prep_for_reset()
10725 i40e_vc_notify_reset(pf); in i40e_prep_for_reset()
10727 dev_dbg(&pf->pdev->dev, "Tearing down internal switch for reset\n"); in i40e_prep_for_reset()
10730 i40e_pf_quiesce_all_vsi(pf); in i40e_prep_for_reset()
10732 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_prep_for_reset()
10733 if (pf->vsi[v]) { in i40e_prep_for_reset()
10734 i40e_clean_xps_state(pf->vsi[v]); in i40e_prep_for_reset()
10735 pf->vsi[v]->seid = 0; in i40e_prep_for_reset()
10739 i40e_shutdown_adminq(&pf->hw); in i40e_prep_for_reset()
10745 dev_warn(&pf->pdev->dev, in i40e_prep_for_reset()
10752 i40e_ptp_save_hw_time(pf); in i40e_prep_for_reset()
10759 static void i40e_send_version(struct i40e_pf *pf) in i40e_send_version() argument
10768 i40e_aq_send_driver_version(&pf->hw, &dv, NULL); in i40e_send_version()
10820 static int i40e_reset(struct i40e_pf *pf) in i40e_reset() argument
10822 struct i40e_hw *hw = &pf->hw; in i40e_reset()
10827 dev_info(&pf->pdev->dev, "PF reset failed, %d\n", ret); in i40e_reset()
10828 set_bit(__I40E_RESET_FAILED, pf->state); in i40e_reset()
10829 clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state); in i40e_reset()
10831 pf->pfr_count++; in i40e_reset()
10843 static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) in i40e_rebuild() argument
10845 const bool is_recovery_mode_reported = i40e_check_recovery_mode(pf); in i40e_rebuild()
10846 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_rebuild()
10847 struct i40e_hw *hw = &pf->hw; in i40e_rebuild()
10852 if (test_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state) && in i40e_rebuild()
10854 i40e_set_ethtool_ops(pf->vsi[pf->lan_vsi]->netdev); in i40e_rebuild()
10856 if (test_bit(__I40E_DOWN, pf->state) && in i40e_rebuild()
10857 !test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_rebuild()
10859 dev_dbg(&pf->pdev->dev, "Rebuilding internal switch\n"); in i40e_rebuild()
10862 ret = i40e_init_adminq(&pf->hw); in i40e_rebuild()
10864 dev_info(&pf->pdev->dev, "Rebuild AdminQ failed, err %pe aq_err %s\n", in i40e_rebuild()
10866 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_rebuild()
10869 i40e_get_oem_version(&pf->hw); in i40e_rebuild()
10871 if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) { in i40e_rebuild()
10877 if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) in i40e_rebuild()
10878 i40e_verify_eeprom(pf); in i40e_rebuild()
10884 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_rebuild()
10885 if (i40e_get_capabilities(pf, in i40e_rebuild()
10893 if (i40e_setup_misc_vector_for_recovery_mode(pf)) in i40e_rebuild()
10902 free_irq(pf->pdev->irq, pf); in i40e_rebuild()
10903 i40e_clear_interrupt_scheme(pf); in i40e_rebuild()
10904 if (i40e_restore_interrupt_scheme(pf)) in i40e_rebuild()
10909 i40e_send_version(pf); in i40e_rebuild()
10918 ret = i40e_get_capabilities(pf, i40e_aqc_opc_list_func_capabilities); in i40e_rebuild()
10925 dev_info(&pf->pdev->dev, "init_lan_hmc failed: %d\n", ret); in i40e_rebuild()
10930 dev_info(&pf->pdev->dev, "configure_lan_hmc failed: %d\n", ret); in i40e_rebuild()
10939 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_rebuild()
10946 dev_warn(&pf->pdev->dev, in i40e_rebuild()
10948 pf->flags &= ~I40E_FLAG_DCB_CAPABLE; in i40e_rebuild()
10951 ret = i40e_init_pf_dcb(pf); in i40e_rebuild()
10953 dev_info(&pf->pdev->dev, "DCB init failed %d, disabled\n", in i40e_rebuild()
10955 pf->flags &= ~I40E_FLAG_DCB_CAPABLE; in i40e_rebuild()
10964 ret = i40e_setup_pf_switch(pf, reinit, true); in i40e_rebuild()
10971 ret = i40e_aq_set_phy_int_mask(&pf->hw, in i40e_rebuild()
10976 dev_info(&pf->pdev->dev, "set phy mask fail, err %pe aq_err %s\n", in i40e_rebuild()
10978 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_rebuild()
10987 if (vsi->uplink_seid != pf->mac_seid) { in i40e_rebuild()
10988 dev_dbg(&pf->pdev->dev, "attempting to rebuild switch\n"); in i40e_rebuild()
10991 if (!pf->veb[v]) in i40e_rebuild()
10994 if (pf->veb[v]->uplink_seid == pf->mac_seid || in i40e_rebuild()
10995 pf->veb[v]->uplink_seid == 0) { in i40e_rebuild()
10996 ret = i40e_reconstitute_veb(pf->veb[v]); in i40e_rebuild()
11007 if (pf->veb[v]->uplink_seid == pf->mac_seid) { in i40e_rebuild()
11008 dev_info(&pf->pdev->dev, in i40e_rebuild()
11011 vsi->uplink_seid = pf->mac_seid; in i40e_rebuild()
11013 } else if (pf->veb[v]->uplink_seid == 0) { in i40e_rebuild()
11014 dev_info(&pf->pdev->dev, in i40e_rebuild()
11022 if (vsi->uplink_seid == pf->mac_seid) { in i40e_rebuild()
11023 dev_dbg(&pf->pdev->dev, "attempting to rebuild PF VSI\n"); in i40e_rebuild()
11027 dev_info(&pf->pdev->dev, in i40e_rebuild()
11076 if (pf->hw_features & I40E_HW_RESTART_AUTONEG) { in i40e_rebuild()
11078 ret = i40e_aq_set_link_restart_an(&pf->hw, true, NULL); in i40e_rebuild()
11080 dev_info(&pf->pdev->dev, "link restart failed, err %pe aq_err %s\n", in i40e_rebuild()
11082 i40e_aq_str(&pf->hw, in i40e_rebuild()
11083 pf->hw.aq.asq_last_status)); in i40e_rebuild()
11086 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_rebuild()
11087 ret = i40e_setup_misc_vector(pf); in i40e_rebuild()
11098 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, in i40e_rebuild()
11099 pf->main_vsi_seid); in i40e_rebuild()
11102 i40e_pf_unquiesce_all_vsi(pf); in i40e_rebuild()
11109 ret = i40e_set_promiscuous(pf, pf->cur_promisc); in i40e_rebuild()
11111 dev_warn(&pf->pdev->dev, in i40e_rebuild()
11113 pf->cur_promisc ? "on" : "off", in i40e_rebuild()
11115 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_rebuild()
11117 i40e_reset_all_vfs(pf, true); in i40e_rebuild()
11120 i40e_send_version(pf); in i40e_rebuild()
11129 clear_bit(__I40E_RESET_FAILED, pf->state); in i40e_rebuild()
11131 clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state); in i40e_rebuild()
11132 clear_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state); in i40e_rebuild()
11142 static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit, in i40e_reset_and_rebuild() argument
11147 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_reset_and_rebuild()
11153 ret = i40e_reset(pf); in i40e_reset_and_rebuild()
11155 i40e_rebuild(pf, reinit, lock_acquired); in i40e_reset_and_rebuild()
11167 static void i40e_handle_reset_warning(struct i40e_pf *pf, bool lock_acquired) in i40e_handle_reset_warning() argument
11169 i40e_prep_for_reset(pf); in i40e_handle_reset_warning()
11170 i40e_reset_and_rebuild(pf, false, lock_acquired); in i40e_handle_reset_warning()
11179 static void i40e_handle_mdd_event(struct i40e_pf *pf) in i40e_handle_mdd_event() argument
11181 struct i40e_hw *hw = &pf->hw; in i40e_handle_mdd_event()
11187 if (!test_bit(__I40E_MDD_EVENT_PENDING, pf->state)) in i40e_handle_mdd_event()
11201 pf->hw.func_caps.base_queue; in i40e_handle_mdd_event()
11202 if (netif_msg_tx_err(pf)) in i40e_handle_mdd_event()
11203 …dev_info(&pf->pdev->dev, "Malicious Driver Detection event 0x%02x on TX queue %d PF number 0x%02x … in i40e_handle_mdd_event()
11216 pf->hw.func_caps.base_queue; in i40e_handle_mdd_event()
11217 if (netif_msg_rx_err(pf)) in i40e_handle_mdd_event()
11218 …dev_info(&pf->pdev->dev, "Malicious Driver Detection event 0x%02x on RX queue %d of function 0x%02… in i40e_handle_mdd_event()
11228 dev_dbg(&pf->pdev->dev, "TX driver issue detected on PF\n"); in i40e_handle_mdd_event()
11233 dev_dbg(&pf->pdev->dev, "RX driver issue detected on PF\n"); in i40e_handle_mdd_event()
11238 for (i = 0; i < pf->num_alloc_vfs && mdd_detected; i++) { in i40e_handle_mdd_event()
11239 vf = &(pf->vf[i]); in i40e_handle_mdd_event()
11244 dev_info(&pf->pdev->dev, "TX driver issue detected on VF %d\n", in i40e_handle_mdd_event()
11246 dev_info(&pf->pdev->dev, in i40e_handle_mdd_event()
11255 dev_info(&pf->pdev->dev, "RX driver issue detected on VF %d\n", in i40e_handle_mdd_event()
11257 dev_info(&pf->pdev->dev, in i40e_handle_mdd_event()
11264 clear_bit(__I40E_MDD_EVENT_PENDING, pf->state); in i40e_handle_mdd_event()
11277 struct i40e_pf *pf = container_of(work, in i40e_service_task() local
11283 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) || in i40e_service_task()
11284 test_bit(__I40E_SUSPENDED, pf->state)) in i40e_service_task()
11287 if (test_and_set_bit(__I40E_SERVICE_SCHED, pf->state)) in i40e_service_task()
11290 if (!test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_service_task()
11291 i40e_detect_recover_hung(pf->vsi[pf->lan_vsi]); in i40e_service_task()
11292 i40e_sync_filters_subtask(pf); in i40e_service_task()
11293 i40e_reset_subtask(pf); in i40e_service_task()
11294 i40e_handle_mdd_event(pf); in i40e_service_task()
11295 i40e_vc_process_vflr_event(pf); in i40e_service_task()
11296 i40e_watchdog_subtask(pf); in i40e_service_task()
11297 i40e_fdir_reinit_subtask(pf); in i40e_service_task()
11298 if (test_and_clear_bit(__I40E_CLIENT_RESET, pf->state)) { in i40e_service_task()
11300 i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], in i40e_service_task()
11303 i40e_client_subtask(pf); in i40e_service_task()
11305 pf->state)) in i40e_service_task()
11307 pf->vsi[pf->lan_vsi]); in i40e_service_task()
11309 i40e_sync_filters_subtask(pf); in i40e_service_task()
11311 i40e_reset_subtask(pf); in i40e_service_task()
11314 i40e_clean_adminq_subtask(pf); in i40e_service_task()
11318 clear_bit(__I40E_SERVICE_SCHED, pf->state); in i40e_service_task()
11324 if (time_after(jiffies, (start_time + pf->service_timer_period)) || in i40e_service_task()
11325 test_bit(__I40E_ADMINQ_EVENT_PENDING, pf->state) || in i40e_service_task()
11326 test_bit(__I40E_MDD_EVENT_PENDING, pf->state) || in i40e_service_task()
11327 test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_service_task()
11328 i40e_service_event_schedule(pf); in i40e_service_task()
11337 struct i40e_pf *pf = from_timer(pf, t, service_timer); in i40e_service_timer() local
11339 mod_timer(&pf->service_timer, in i40e_service_timer()
11340 round_jiffies(jiffies + pf->service_timer_period)); in i40e_service_timer()
11341 i40e_service_event_schedule(pf); in i40e_service_timer()
11350 struct i40e_pf *pf = vsi->back; in i40e_set_num_rings_in_vsi() local
11354 vsi->alloc_queue_pairs = pf->num_lan_qps; in i40e_set_num_rings_in_vsi()
11361 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_set_num_rings_in_vsi()
11362 vsi->num_q_vectors = pf->num_lan_msix; in i40e_set_num_rings_in_vsi()
11374 vsi->num_q_vectors = pf->num_fdsb_msix; in i40e_set_num_rings_in_vsi()
11378 vsi->alloc_queue_pairs = pf->num_vmdq_qps; in i40e_set_num_rings_in_vsi()
11385 vsi->num_q_vectors = pf->num_vmdq_msix; in i40e_set_num_rings_in_vsi()
11389 vsi->alloc_queue_pairs = pf->num_vf_qps; in i40e_set_num_rings_in_vsi()
11462 static int i40e_vsi_mem_alloc(struct i40e_pf *pf, enum i40e_vsi_type type) in i40e_vsi_mem_alloc() argument
11470 mutex_lock(&pf->switch_mutex); in i40e_vsi_mem_alloc()
11478 i = pf->next_vsi; in i40e_vsi_mem_alloc()
11479 while (i < pf->num_alloc_vsi && pf->vsi[i]) in i40e_vsi_mem_alloc()
11481 if (i >= pf->num_alloc_vsi) { in i40e_vsi_mem_alloc()
11483 while (i < pf->next_vsi && pf->vsi[i]) in i40e_vsi_mem_alloc()
11487 if (i < pf->num_alloc_vsi && !pf->vsi[i]) { in i40e_vsi_mem_alloc()
11493 pf->next_vsi = ++i; in i40e_vsi_mem_alloc()
11501 vsi->back = pf; in i40e_vsi_mem_alloc()
11507 pf->rss_table_size : 64; in i40e_vsi_mem_alloc()
11514 vsi->af_xdp_zc_qps = bitmap_zalloc(pf->num_lan_qps, GFP_KERNEL); in i40e_vsi_mem_alloc()
11532 pf->vsi[vsi_idx] = vsi; in i40e_vsi_mem_alloc()
11538 pf->next_vsi = i - 1; in i40e_vsi_mem_alloc()
11541 mutex_unlock(&pf->switch_mutex); in i40e_vsi_mem_alloc()
11589 struct i40e_pf *pf; in i40e_vsi_clear() local
11596 pf = vsi->back; in i40e_vsi_clear()
11598 mutex_lock(&pf->switch_mutex); in i40e_vsi_clear()
11599 if (!pf->vsi[vsi->idx]) { in i40e_vsi_clear()
11600 dev_err(&pf->pdev->dev, "pf->vsi[%d] is NULL, just free vsi[%d](type %d)\n", in i40e_vsi_clear()
11605 if (pf->vsi[vsi->idx] != vsi) { in i40e_vsi_clear()
11606 dev_err(&pf->pdev->dev, in i40e_vsi_clear()
11608 pf->vsi[vsi->idx]->idx, in i40e_vsi_clear()
11609 pf->vsi[vsi->idx]->type, in i40e_vsi_clear()
11615 i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx); in i40e_vsi_clear()
11616 i40e_put_lump(pf->irq_pile, vsi->base_vector, vsi->idx); in i40e_vsi_clear()
11622 pf->vsi[vsi->idx] = NULL; in i40e_vsi_clear()
11623 if (vsi->idx < pf->next_vsi) in i40e_vsi_clear()
11624 pf->next_vsi = vsi->idx; in i40e_vsi_clear()
11627 mutex_unlock(&pf->switch_mutex); in i40e_vsi_clear()
11660 struct i40e_pf *pf = vsi->back; in i40e_alloc_rings() local
11675 ring->dev = &pf->pdev->dev; in i40e_alloc_rings()
11681 ring->itr_setting = pf->tx_itr_default; in i40e_alloc_rings()
11692 ring->dev = &pf->pdev->dev; in i40e_alloc_rings()
11699 ring->itr_setting = pf->tx_itr_default; in i40e_alloc_rings()
11708 ring->dev = &pf->pdev->dev; in i40e_alloc_rings()
11712 ring->itr_setting = pf->rx_itr_default; in i40e_alloc_rings()
11730 static int i40e_reserve_msix_vectors(struct i40e_pf *pf, int vectors) in i40e_reserve_msix_vectors() argument
11732 vectors = pci_enable_msix_range(pf->pdev, pf->msix_entries, in i40e_reserve_msix_vectors()
11735 dev_info(&pf->pdev->dev, in i40e_reserve_msix_vectors()
11751 static int i40e_init_msix(struct i40e_pf *pf) in i40e_init_msix() argument
11753 struct i40e_hw *hw = &pf->hw; in i40e_init_msix()
11760 if (!(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_init_msix()
11795 pf->num_lan_msix = min_t(int, cpus, vectors_left / 2); in i40e_init_msix()
11796 vectors_left -= pf->num_lan_msix; in i40e_init_msix()
11799 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_init_msix()
11801 pf->num_fdsb_msix = 1; in i40e_init_msix()
11805 pf->num_fdsb_msix = 0; in i40e_init_msix()
11810 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_init_msix()
11811 iwarp_requested = pf->num_iwarp_msix; in i40e_init_msix()
11814 pf->num_iwarp_msix = 0; in i40e_init_msix()
11815 else if (vectors_left < pf->num_iwarp_msix) in i40e_init_msix()
11816 pf->num_iwarp_msix = 1; in i40e_init_msix()
11817 v_budget += pf->num_iwarp_msix; in i40e_init_msix()
11818 vectors_left -= pf->num_iwarp_msix; in i40e_init_msix()
11822 if (pf->flags & I40E_FLAG_VMDQ_ENABLED) { in i40e_init_msix()
11824 pf->num_vmdq_msix = 0; in i40e_init_msix()
11825 pf->num_vmdq_qps = 0; in i40e_init_msix()
11828 pf->num_vmdq_vsis * pf->num_vmdq_qps; in i40e_init_msix()
11839 pf->num_vmdq_qps = 1; in i40e_init_msix()
11840 vmdq_vecs_wanted = pf->num_vmdq_vsis; in i40e_init_msix()
11845 pf->num_vmdq_msix = pf->num_vmdq_qps; in i40e_init_msix()
11861 extra_vectors = min_t(int, cpus - pf->num_lan_msix, vectors_left); in i40e_init_msix()
11862 pf->num_lan_msix += extra_vectors; in i40e_init_msix()
11868 v_budget += pf->num_lan_msix; in i40e_init_msix()
11869 pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry), in i40e_init_msix()
11871 if (!pf->msix_entries) in i40e_init_msix()
11875 pf->msix_entries[i].entry = i; in i40e_init_msix()
11876 v_actual = i40e_reserve_msix_vectors(pf, v_budget); in i40e_init_msix()
11879 pf->flags &= ~I40E_FLAG_MSIX_ENABLED; in i40e_init_msix()
11880 kfree(pf->msix_entries); in i40e_init_msix()
11881 pf->msix_entries = NULL; in i40e_init_msix()
11882 pci_disable_msix(pf->pdev); in i40e_init_msix()
11887 pf->num_vmdq_vsis = 0; in i40e_init_msix()
11888 pf->num_vmdq_qps = 0; in i40e_init_msix()
11889 pf->num_lan_qps = 1; in i40e_init_msix()
11890 pf->num_lan_msix = 1; in i40e_init_msix()
11900 dev_info(&pf->pdev->dev, in i40e_init_msix()
11907 pf->num_vmdq_msix = 1; /* force VMDqs to only one vector */ in i40e_init_msix()
11908 pf->num_vmdq_vsis = 1; in i40e_init_msix()
11909 pf->num_vmdq_qps = 1; in i40e_init_msix()
11914 pf->num_lan_msix = 1; in i40e_init_msix()
11917 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_init_msix()
11918 pf->num_lan_msix = 1; in i40e_init_msix()
11919 pf->num_iwarp_msix = 1; in i40e_init_msix()
11921 pf->num_lan_msix = 2; in i40e_init_msix()
11925 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_init_msix()
11926 pf->num_iwarp_msix = min_t(int, (vec / 3), in i40e_init_msix()
11928 pf->num_vmdq_vsis = min_t(int, (vec / 3), in i40e_init_msix()
11931 pf->num_vmdq_vsis = min_t(int, (vec / 2), in i40e_init_msix()
11934 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_init_msix()
11935 pf->num_fdsb_msix = 1; in i40e_init_msix()
11938 pf->num_lan_msix = min_t(int, in i40e_init_msix()
11939 (vec - (pf->num_iwarp_msix + pf->num_vmdq_vsis)), in i40e_init_msix()
11940 pf->num_lan_msix); in i40e_init_msix()
11941 pf->num_lan_qps = pf->num_lan_msix; in i40e_init_msix()
11946 if ((pf->flags & I40E_FLAG_FD_SB_ENABLED) && in i40e_init_msix()
11947 (pf->num_fdsb_msix == 0)) { in i40e_init_msix()
11948 dev_info(&pf->pdev->dev, "Sideband Flowdir disabled, not enough MSI-X vectors\n"); in i40e_init_msix()
11949 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; in i40e_init_msix()
11950 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_init_msix()
11952 if ((pf->flags & I40E_FLAG_VMDQ_ENABLED) && in i40e_init_msix()
11953 (pf->num_vmdq_msix == 0)) { in i40e_init_msix()
11954 dev_info(&pf->pdev->dev, "VMDq disabled, not enough MSI-X vectors\n"); in i40e_init_msix()
11955 pf->flags &= ~I40E_FLAG_VMDQ_ENABLED; in i40e_init_msix()
11958 if ((pf->flags & I40E_FLAG_IWARP_ENABLED) && in i40e_init_msix()
11959 (pf->num_iwarp_msix == 0)) { in i40e_init_msix()
11960 dev_info(&pf->pdev->dev, "IWARP disabled, not enough MSI-X vectors\n"); in i40e_init_msix()
11961 pf->flags &= ~I40E_FLAG_IWARP_ENABLED; in i40e_init_msix()
11963 i40e_debug(&pf->hw, I40E_DEBUG_INIT, in i40e_init_msix()
11965 pf->num_lan_msix, in i40e_init_msix()
11966 pf->num_vmdq_msix * pf->num_vmdq_vsis, in i40e_init_msix()
11967 pf->num_fdsb_msix, in i40e_init_msix()
11968 pf->num_iwarp_msix); in i40e_init_msix()
12011 struct i40e_pf *pf = vsi->back; in i40e_vsi_alloc_q_vectors() local
12015 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_vsi_alloc_q_vectors()
12017 else if (vsi == pf->vsi[pf->lan_vsi]) in i40e_vsi_alloc_q_vectors()
12041 static int i40e_init_interrupt_scheme(struct i40e_pf *pf) in i40e_init_interrupt_scheme() argument
12046 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_init_interrupt_scheme()
12047 vectors = i40e_init_msix(pf); in i40e_init_interrupt_scheme()
12049 pf->flags &= ~(I40E_FLAG_MSIX_ENABLED | in i40e_init_interrupt_scheme()
12058 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_init_interrupt_scheme()
12061 i40e_determine_queue_usage(pf); in i40e_init_interrupt_scheme()
12065 if (!(pf->flags & I40E_FLAG_MSIX_ENABLED) && in i40e_init_interrupt_scheme()
12066 (pf->flags & I40E_FLAG_MSI_ENABLED)) { in i40e_init_interrupt_scheme()
12067 dev_info(&pf->pdev->dev, "MSI-X not available, trying MSI\n"); in i40e_init_interrupt_scheme()
12068 vectors = pci_enable_msi(pf->pdev); in i40e_init_interrupt_scheme()
12070 dev_info(&pf->pdev->dev, "MSI init failed - %d\n", in i40e_init_interrupt_scheme()
12072 pf->flags &= ~I40E_FLAG_MSI_ENABLED; in i40e_init_interrupt_scheme()
12077 if (!(pf->flags & (I40E_FLAG_MSIX_ENABLED | I40E_FLAG_MSI_ENABLED))) in i40e_init_interrupt_scheme()
12078 dev_info(&pf->pdev->dev, "MSI-X and MSI not available, falling back to Legacy IRQ\n"); in i40e_init_interrupt_scheme()
12082 pf->irq_pile = kzalloc(size, GFP_KERNEL); in i40e_init_interrupt_scheme()
12083 if (!pf->irq_pile) in i40e_init_interrupt_scheme()
12086 pf->irq_pile->num_entries = vectors; in i40e_init_interrupt_scheme()
12089 (void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1); in i40e_init_interrupt_scheme()
12102 static int i40e_restore_interrupt_scheme(struct i40e_pf *pf) in i40e_restore_interrupt_scheme() argument
12110 pf->flags |= (I40E_FLAG_MSIX_ENABLED | I40E_FLAG_MSI_ENABLED); in i40e_restore_interrupt_scheme()
12112 err = i40e_init_interrupt_scheme(pf); in i40e_restore_interrupt_scheme()
12119 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_restore_interrupt_scheme()
12120 if (pf->vsi[i]) { in i40e_restore_interrupt_scheme()
12121 err = i40e_vsi_alloc_q_vectors(pf->vsi[i]); in i40e_restore_interrupt_scheme()
12124 i40e_vsi_map_rings_to_vectors(pf->vsi[i]); in i40e_restore_interrupt_scheme()
12128 err = i40e_setup_misc_vector(pf); in i40e_restore_interrupt_scheme()
12132 if (pf->flags & I40E_FLAG_IWARP_ENABLED) in i40e_restore_interrupt_scheme()
12133 i40e_client_update_msix_info(pf); in i40e_restore_interrupt_scheme()
12139 if (pf->vsi[i]) in i40e_restore_interrupt_scheme()
12140 i40e_vsi_free_q_vectors(pf->vsi[i]); in i40e_restore_interrupt_scheme()
12156 static int i40e_setup_misc_vector_for_recovery_mode(struct i40e_pf *pf) in i40e_setup_misc_vector_for_recovery_mode() argument
12160 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_setup_misc_vector_for_recovery_mode()
12161 err = i40e_setup_misc_vector(pf); in i40e_setup_misc_vector_for_recovery_mode()
12164 dev_info(&pf->pdev->dev, in i40e_setup_misc_vector_for_recovery_mode()
12170 u32 flags = pf->flags & I40E_FLAG_MSI_ENABLED ? 0 : IRQF_SHARED; in i40e_setup_misc_vector_for_recovery_mode()
12172 err = request_irq(pf->pdev->irq, i40e_intr, flags, in i40e_setup_misc_vector_for_recovery_mode()
12173 pf->int_name, pf); in i40e_setup_misc_vector_for_recovery_mode()
12176 dev_info(&pf->pdev->dev, in i40e_setup_misc_vector_for_recovery_mode()
12181 i40e_enable_misc_int_causes(pf); in i40e_setup_misc_vector_for_recovery_mode()
12182 i40e_irq_dynamic_enable_icr0(pf); in i40e_setup_misc_vector_for_recovery_mode()
12196 static int i40e_setup_misc_vector(struct i40e_pf *pf) in i40e_setup_misc_vector() argument
12198 struct i40e_hw *hw = &pf->hw; in i40e_setup_misc_vector()
12202 if (!test_and_set_bit(__I40E_MISC_IRQ_REQUESTED, pf->state)) { in i40e_setup_misc_vector()
12203 err = request_irq(pf->msix_entries[0].vector, in i40e_setup_misc_vector()
12204 i40e_intr, 0, pf->int_name, pf); in i40e_setup_misc_vector()
12206 clear_bit(__I40E_MISC_IRQ_REQUESTED, pf->state); in i40e_setup_misc_vector()
12207 dev_info(&pf->pdev->dev, in i40e_setup_misc_vector()
12209 pf->int_name, err); in i40e_setup_misc_vector()
12214 i40e_enable_misc_int_causes(pf); in i40e_setup_misc_vector()
12222 i40e_irq_dynamic_enable_icr0(pf); in i40e_setup_misc_vector()
12239 struct i40e_pf *pf = vsi->back; in i40e_get_rss_aq() local
12240 struct i40e_hw *hw = &pf->hw; in i40e_get_rss_aq()
12247 dev_info(&pf->pdev->dev, in i40e_get_rss_aq()
12250 i40e_aq_str(&pf->hw, in i40e_get_rss_aq()
12251 pf->hw.aq.asq_last_status)); in i40e_get_rss_aq()
12261 dev_info(&pf->pdev->dev, in i40e_get_rss_aq()
12264 i40e_aq_str(&pf->hw, in i40e_get_rss_aq()
12265 pf->hw.aq.asq_last_status)); in i40e_get_rss_aq()
12285 struct i40e_pf *pf = vsi->back; in i40e_config_rss_reg() local
12286 struct i40e_hw *hw = &pf->hw; in i40e_config_rss_reg()
12301 dev_err(&pf->pdev->dev, "Cannot set RSS seed - invalid VSI type\n"); in i40e_config_rss_reg()
12319 dev_err(&pf->pdev->dev, "Cannot set RSS LUT - invalid VSI type\n"); in i40e_config_rss_reg()
12339 struct i40e_pf *pf = vsi->back; in i40e_get_rss_reg() local
12340 struct i40e_hw *hw = &pf->hw; in i40e_get_rss_reg()
12372 struct i40e_pf *pf = vsi->back; in i40e_config_rss() local
12374 if (pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) in i40e_config_rss()
12391 struct i40e_pf *pf = vsi->back; in i40e_get_rss() local
12393 if (pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) in i40e_get_rss()
12406 void i40e_fill_rss_lut(struct i40e_pf *pf, u8 *lut, in i40e_fill_rss_lut() argument
12419 static int i40e_pf_config_rss(struct i40e_pf *pf) in i40e_pf_config_rss() argument
12421 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_pf_config_rss()
12424 struct i40e_hw *hw = &pf->hw; in i40e_pf_config_rss()
12432 hena |= i40e_pf_get_default_rss_hena(pf); in i40e_pf_config_rss()
12439 reg_val = (pf->rss_table_size == 512) ? in i40e_pf_config_rss()
12454 vsi->rss_size = min_t(int, pf->alloc_rss_size, qcount); in i40e_pf_config_rss()
12467 i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size); in i40e_pf_config_rss()
12491 int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count) in i40e_reconfig_rss_queues() argument
12493 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_reconfig_rss_queues()
12496 if (!(pf->flags & I40E_FLAG_RSS_ENABLED)) in i40e_reconfig_rss_queues()
12500 new_rss_size = min_t(int, queue_count, pf->rss_size_max); in i40e_reconfig_rss_queues()
12506 i40e_prep_for_reset(pf); in i40e_reconfig_rss_queues()
12507 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_reconfig_rss_queues()
12508 return pf->alloc_rss_size; in i40e_reconfig_rss_queues()
12510 pf->alloc_rss_size = new_rss_size; in i40e_reconfig_rss_queues()
12512 i40e_reset_and_rebuild(pf, true, true); in i40e_reconfig_rss_queues()
12519 dev_dbg(&pf->pdev->dev, in i40e_reconfig_rss_queues()
12525 vsi->rss_size = min_t(int, pf->alloc_rss_size, qcount); in i40e_reconfig_rss_queues()
12527 i40e_pf_config_rss(pf); in i40e_reconfig_rss_queues()
12529 dev_info(&pf->pdev->dev, "User requested queue count/HW max RSS count: %d/%d\n", in i40e_reconfig_rss_queues()
12530 vsi->req_queue_pairs, pf->rss_size_max); in i40e_reconfig_rss_queues()
12531 return pf->alloc_rss_size; in i40e_reconfig_rss_queues()
12538 int i40e_get_partition_bw_setting(struct i40e_pf *pf) in i40e_get_partition_bw_setting() argument
12544 status = i40e_read_bw_from_alt_ram(&pf->hw, &max_bw, &min_bw, in i40e_get_partition_bw_setting()
12549 pf->min_bw = min_bw; in i40e_get_partition_bw_setting()
12551 pf->max_bw = max_bw; in i40e_get_partition_bw_setting()
12561 int i40e_set_partition_bw_setting(struct i40e_pf *pf) in i40e_set_partition_bw_setting() argument
12569 bw_data.pf_valid_bits = cpu_to_le16(BIT(pf->hw.pf_id)); in i40e_set_partition_bw_setting()
12570 bw_data.max_bw[pf->hw.pf_id] = pf->max_bw & I40E_ALT_BW_VALUE_MASK; in i40e_set_partition_bw_setting()
12571 bw_data.min_bw[pf->hw.pf_id] = pf->min_bw & I40E_ALT_BW_VALUE_MASK; in i40e_set_partition_bw_setting()
12574 status = i40e_aq_configure_partition_bw(&pf->hw, &bw_data, NULL); in i40e_set_partition_bw_setting()
12583 int i40e_commit_partition_bw_setting(struct i40e_pf *pf) in i40e_commit_partition_bw_setting() argument
12590 if (pf->hw.partition_id != 1) { in i40e_commit_partition_bw_setting()
12591 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12593 pf->hw.partition_id); in i40e_commit_partition_bw_setting()
12599 ret = i40e_acquire_nvm(&pf->hw, I40E_RESOURCE_READ); in i40e_commit_partition_bw_setting()
12600 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12602 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12605 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12610 ret = i40e_aq_read_nvm(&pf->hw, in i40e_commit_partition_bw_setting()
12617 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12618 i40e_release_nvm(&pf->hw); in i40e_commit_partition_bw_setting()
12620 dev_info(&pf->pdev->dev, "NVM read error, err %pe aq_err %s\n", in i40e_commit_partition_bw_setting()
12622 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12630 ret = i40e_acquire_nvm(&pf->hw, I40E_RESOURCE_WRITE); in i40e_commit_partition_bw_setting()
12631 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12633 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12636 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12643 ret = i40e_aq_update_nvm(&pf->hw, in i40e_commit_partition_bw_setting()
12650 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12651 i40e_release_nvm(&pf->hw); in i40e_commit_partition_bw_setting()
12653 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12656 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12667 static bool i40e_is_total_port_shutdown_enabled(struct i40e_pf *pf) in i40e_is_total_port_shutdown_enabled() argument
12682 read_status = i40e_read_nvm_word(&pf->hw, in i40e_is_total_port_shutdown_enabled()
12687 read_status = i40e_read_nvm_word(&pf->hw, in i40e_is_total_port_shutdown_enabled()
12694 read_status = i40e_read_nvm_module_data(&pf->hw, in i40e_is_total_port_shutdown_enabled()
12702 link_behavior >>= (pf->hw.port * I40E_LINK_BEHAVIOR_PORT_BIT_LENGTH); in i40e_is_total_port_shutdown_enabled()
12708 dev_warn(&pf->pdev->dev, in i40e_is_total_port_shutdown_enabled()
12722 static int i40e_sw_init(struct i40e_pf *pf) in i40e_sw_init() argument
12729 pf->flags = I40E_FLAG_RX_CSUM_ENABLED | in i40e_sw_init()
12734 pf->rx_itr_default = I40E_ITR_RX_DEF; in i40e_sw_init()
12735 pf->tx_itr_default = I40E_ITR_TX_DEF; in i40e_sw_init()
12740 pf->rss_size_max = BIT(pf->hw.func_caps.rss_table_entry_width); in i40e_sw_init()
12741 pf->alloc_rss_size = 1; in i40e_sw_init()
12742 pf->rss_table_size = pf->hw.func_caps.rss_table_size; in i40e_sw_init()
12743 pf->rss_size_max = min_t(int, pf->rss_size_max, in i40e_sw_init()
12744 pf->hw.func_caps.num_tx_qp); in i40e_sw_init()
12748 pf->rss_size_max = min_t(int, pf->rss_size_max, pow); in i40e_sw_init()
12750 if (pf->hw.func_caps.rss) { in i40e_sw_init()
12751 pf->flags |= I40E_FLAG_RSS_ENABLED; in i40e_sw_init()
12752 pf->alloc_rss_size = min_t(int, pf->rss_size_max, in i40e_sw_init()
12757 if (pf->hw.func_caps.npar_enable || pf->hw.func_caps.flex10_enable) { in i40e_sw_init()
12758 pf->flags |= I40E_FLAG_MFP_ENABLED; in i40e_sw_init()
12759 dev_info(&pf->pdev->dev, "MFP mode Enabled\n"); in i40e_sw_init()
12760 if (i40e_get_partition_bw_setting(pf)) { in i40e_sw_init()
12761 dev_warn(&pf->pdev->dev, in i40e_sw_init()
12764 dev_info(&pf->pdev->dev, in i40e_sw_init()
12766 pf->min_bw, pf->max_bw); in i40e_sw_init()
12769 i40e_set_partition_bw_setting(pf); in i40e_sw_init()
12773 if ((pf->hw.func_caps.fd_filters_guaranteed > 0) || in i40e_sw_init()
12774 (pf->hw.func_caps.fd_filters_best_effort > 0)) { in i40e_sw_init()
12775 pf->flags |= I40E_FLAG_FD_ATR_ENABLED; in i40e_sw_init()
12776 pf->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE; in i40e_sw_init()
12777 if (pf->flags & I40E_FLAG_MFP_ENABLED && in i40e_sw_init()
12778 pf->hw.num_partitions > 1) in i40e_sw_init()
12779 dev_info(&pf->pdev->dev, in i40e_sw_init()
12782 pf->flags |= I40E_FLAG_FD_SB_ENABLED; in i40e_sw_init()
12783 pf->fdir_pf_filter_count = in i40e_sw_init()
12784 pf->hw.func_caps.fd_filters_guaranteed; in i40e_sw_init()
12785 pf->hw.fdir_shared_filter_count = in i40e_sw_init()
12786 pf->hw.func_caps.fd_filters_best_effort; in i40e_sw_init()
12789 if (pf->hw.mac.type == I40E_MAC_X722) { in i40e_sw_init()
12790 pf->hw_features |= (I40E_HW_RSS_AQ_CAPABLE | in i40e_sw_init()
12803 if (rd32(&pf->hw, I40E_GLQF_FDEVICTENA(1)) != in i40e_sw_init()
12805 dev_warn(&pf->pdev->dev, in i40e_sw_init()
12807 pf->hw_features &= ~I40E_HW_ATR_EVICT_CAPABLE; in i40e_sw_init()
12809 } else if ((pf->hw.aq.api_maj_ver > 1) || in i40e_sw_init()
12810 ((pf->hw.aq.api_maj_ver == 1) && in i40e_sw_init()
12811 (pf->hw.aq.api_min_ver > 4))) { in i40e_sw_init()
12813 pf->hw_features |= I40E_HW_GENEVE_OFFLOAD_CAPABLE; in i40e_sw_init()
12817 if (pf->hw_features & I40E_HW_ATR_EVICT_CAPABLE) in i40e_sw_init()
12818 pf->flags |= I40E_FLAG_HW_ATR_EVICT_ENABLED; in i40e_sw_init()
12820 if ((pf->hw.mac.type == I40E_MAC_XL710) && in i40e_sw_init()
12821 (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) || in i40e_sw_init()
12822 (pf->hw.aq.fw_maj_ver < 4))) { in i40e_sw_init()
12823 pf->hw_features |= I40E_HW_RESTART_AUTONEG; in i40e_sw_init()
12825 pf->hw_features |= I40E_HW_NO_DCB_SUPPORT; in i40e_sw_init()
12829 if ((pf->hw.mac.type == I40E_MAC_XL710) && in i40e_sw_init()
12830 (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 3)) || in i40e_sw_init()
12831 (pf->hw.aq.fw_maj_ver < 4))) in i40e_sw_init()
12832 pf->hw_features |= I40E_HW_STOP_FW_LLDP; in i40e_sw_init()
12835 if ((pf->hw.mac.type == I40E_MAC_XL710) && in i40e_sw_init()
12836 (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver >= 40)) || in i40e_sw_init()
12837 (pf->hw.aq.fw_maj_ver >= 5))) in i40e_sw_init()
12838 pf->hw_features |= I40E_HW_USE_SET_LLDP_MIB; in i40e_sw_init()
12841 if (pf->hw.mac.type == I40E_MAC_XL710 && in i40e_sw_init()
12842 pf->hw.aq.fw_maj_ver >= 6) in i40e_sw_init()
12843 pf->hw_features |= I40E_HW_PTP_L4_CAPABLE; in i40e_sw_init()
12845 if (pf->hw.func_caps.vmdq && num_online_cpus() != 1) { in i40e_sw_init()
12846 pf->num_vmdq_vsis = I40E_DEFAULT_NUM_VMDQ_VSI; in i40e_sw_init()
12847 pf->flags |= I40E_FLAG_VMDQ_ENABLED; in i40e_sw_init()
12848 pf->num_vmdq_qps = i40e_default_queues_per_vmdq(pf); in i40e_sw_init()
12851 if (pf->hw.func_caps.iwarp && num_online_cpus() != 1) { in i40e_sw_init()
12852 pf->flags |= I40E_FLAG_IWARP_ENABLED; in i40e_sw_init()
12854 pf->num_iwarp_msix = (int)num_online_cpus() + 1; in i40e_sw_init()
12861 if (pf->hw.mac.type == I40E_MAC_XL710 && in i40e_sw_init()
12862 pf->hw.func_caps.npar_enable && in i40e_sw_init()
12863 (pf->hw.flags & I40E_HW_FLAG_FW_LLDP_STOPPABLE)) in i40e_sw_init()
12864 pf->hw.flags &= ~I40E_HW_FLAG_FW_LLDP_STOPPABLE; in i40e_sw_init()
12867 if (pf->hw.func_caps.num_vfs && pf->hw.partition_id == 1) { in i40e_sw_init()
12868 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_sw_init()
12869 pf->flags |= I40E_FLAG_SRIOV_ENABLED; in i40e_sw_init()
12870 pf->num_req_vfs = min_t(int, in i40e_sw_init()
12871 pf->hw.func_caps.num_vfs, in i40e_sw_init()
12875 pf->eeprom_version = 0xDEAD; in i40e_sw_init()
12876 pf->lan_veb = I40E_NO_VEB; in i40e_sw_init()
12877 pf->lan_vsi = I40E_NO_VSI; in i40e_sw_init()
12880 pf->flags &= ~I40E_FLAG_VEB_STATS_ENABLED; in i40e_sw_init()
12884 + (sizeof(u16) * pf->hw.func_caps.num_tx_qp); in i40e_sw_init()
12885 pf->qp_pile = kzalloc(size, GFP_KERNEL); in i40e_sw_init()
12886 if (!pf->qp_pile) { in i40e_sw_init()
12890 pf->qp_pile->num_entries = pf->hw.func_caps.num_tx_qp; in i40e_sw_init()
12892 pf->tx_timeout_recovery_level = 1; in i40e_sw_init()
12894 if (pf->hw.mac.type != I40E_MAC_X722 && in i40e_sw_init()
12895 i40e_is_total_port_shutdown_enabled(pf)) { in i40e_sw_init()
12899 pf->flags |= (I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED | in i40e_sw_init()
12901 dev_info(&pf->pdev->dev, in i40e_sw_init()
12904 mutex_init(&pf->switch_mutex); in i40e_sw_init()
12917 bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features) in i40e_set_ntuple() argument
12926 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) in i40e_set_ntuple()
12931 if (pf->num_fdsb_msix > 0 && !pf->num_cloud_filters) { in i40e_set_ntuple()
12932 pf->flags |= I40E_FLAG_FD_SB_ENABLED; in i40e_set_ntuple()
12933 pf->flags &= ~I40E_FLAG_FD_SB_INACTIVE; in i40e_set_ntuple()
12937 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_set_ntuple()
12939 i40e_fdir_filter_exit(pf); in i40e_set_ntuple()
12941 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; in i40e_set_ntuple()
12942 clear_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state); in i40e_set_ntuple()
12943 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_set_ntuple()
12946 pf->fd_add_err = 0; in i40e_set_ntuple()
12947 pf->fd_atr_cnt = 0; in i40e_set_ntuple()
12949 if (test_and_clear_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state)) in i40e_set_ntuple()
12950 if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) && in i40e_set_ntuple()
12951 (I40E_DEBUG_FD & pf->hw.debug_mask)) in i40e_set_ntuple()
12952 dev_info(&pf->pdev->dev, "ATR re-enabled.\n"); in i40e_set_ntuple()
12963 struct i40e_pf *pf = vsi->back; in i40e_clear_rss_lut() local
12964 struct i40e_hw *hw = &pf->hw; in i40e_clear_rss_lut()
12975 dev_err(&pf->pdev->dev, "Cannot set RSS LUT - invalid VSI type\n"); in i40e_clear_rss_lut()
13013 struct i40e_pf *pf = vsi->back; in i40e_set_features() local
13017 i40e_pf_config_rss(pf); in i40e_set_features()
13028 (netdev->features & NETIF_F_HW_TC) && pf->num_cloud_filters) { in i40e_set_features()
13029 dev_err(&pf->pdev->dev, in i40e_set_features()
13037 need_reset = i40e_set_ntuple(pf, features); in i40e_set_features()
13040 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_set_features()
13096 struct i40e_pf *pf = np->vsi->back; in i40e_get_phys_port_id() local
13097 struct i40e_hw *hw = &pf->hw; in i40e_get_phys_port_id()
13099 if (!(pf->hw_features & I40E_HW_PORT_ID_VALID)) in i40e_get_phys_port_id()
13125 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_fdb_add() local
13128 if (!(pf->flags & I40E_FLAG_SRIOV_ENABLED)) in i40e_ndo_fdb_add()
13181 struct i40e_pf *pf = vsi->back; in i40e_ndo_bridge_setlink() local
13187 if (vsi->seid != pf->vsi[pf->lan_vsi]->seid) in i40e_ndo_bridge_setlink()
13192 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_ndo_bridge_setlink()
13193 veb = pf->veb[i]; in i40e_ndo_bridge_setlink()
13213 veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid, in i40e_ndo_bridge_setlink()
13228 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_ndo_bridge_setlink()
13230 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_ndo_bridge_setlink()
13231 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_ndo_bridge_setlink()
13258 struct i40e_pf *pf = vsi->back; in i40e_ndo_bridge_getlink() local
13263 if (vsi->seid != pf->vsi[pf->lan_vsi]->seid) in i40e_ndo_bridge_getlink()
13268 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_ndo_bridge_getlink()
13269 veb = pf->veb[i]; in i40e_ndo_bridge_getlink()
13347 struct i40e_pf *pf = vsi->back; in i40e_xdp_setup() local
13362 i40e_prep_for_reset(pf); in i40e_xdp_setup()
13365 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_xdp_setup()
13376 i40e_reset_and_rebuild(pf, true, true); in i40e_xdp_setup()
13415 struct i40e_pf *pf = vsi->back; in i40e_enter_busy_conf() local
13418 while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) { in i40e_enter_busy_conf()
13434 struct i40e_pf *pf = vsi->back; in i40e_exit_busy_conf() local
13436 clear_bit(__I40E_CONFIG_BUSY, pf->state); in i40e_exit_busy_conf()
13509 struct i40e_pf *pf = vsi->back; in i40e_queue_pair_toggle_rings() local
13513 ret = i40e_control_wait_tx_q(vsi->seid, pf, pf_q, in i40e_queue_pair_toggle_rings()
13516 dev_info(&pf->pdev->dev, in i40e_queue_pair_toggle_rings()
13522 i40e_control_rx_q(pf, pf_q, enable); in i40e_queue_pair_toggle_rings()
13523 ret = i40e_pf_rxq_wait(pf, pf_q, enable); in i40e_queue_pair_toggle_rings()
13525 dev_info(&pf->pdev->dev, in i40e_queue_pair_toggle_rings()
13540 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_queue_pair_toggle_rings()
13544 dev_info(&pf->pdev->dev, in i40e_queue_pair_toggle_rings()
13560 struct i40e_pf *pf = vsi->back; in i40e_queue_pair_enable_irq() local
13561 struct i40e_hw *hw = &pf->hw; in i40e_queue_pair_enable_irq()
13564 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_queue_pair_enable_irq()
13567 i40e_irq_dynamic_enable_icr0(pf); in i40e_queue_pair_enable_irq()
13580 struct i40e_pf *pf = vsi->back; in i40e_queue_pair_disable_irq() local
13581 struct i40e_hw *hw = &pf->hw; in i40e_queue_pair_disable_irq()
13589 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_queue_pair_disable_irq()
13594 synchronize_irq(pf->msix_entries[intpf].vector); in i40e_queue_pair_disable_irq()
13600 synchronize_irq(pf->pdev->irq); in i40e_queue_pair_disable_irq()
13735 struct i40e_pf *pf = vsi->back; in i40e_config_netdev() local
13736 struct i40e_hw *hw = &pf->hw; in i40e_config_netdev()
13774 if (!(pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE)) in i40e_config_netdev()
13777 netdev->udp_tunnel_nic_info = &pf->udp_tunnel_nic; in i40e_config_netdev()
13810 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) in i40e_config_netdev()
13821 SET_NETDEV_DEV(netdev, &pf->pdev->dev); in i40e_config_netdev()
13851 pf->vsi[pf->lan_vsi]->netdev->name); in i40e_config_netdev()
13923 struct i40e_pf *pf = vsi->back; in i40e_is_vsi_uplink_mode_veb() local
13929 veb = pf->veb[vsi->veb_idx]; in i40e_is_vsi_uplink_mode_veb()
13931 dev_info(&pf->pdev->dev, in i40e_is_vsi_uplink_mode_veb()
13958 struct i40e_pf *pf = vsi->back; in i40e_add_vsi() local
13959 struct i40e_hw *hw = &pf->hw; in i40e_add_vsi()
13976 ctxt.seid = pf->main_vsi_seid; in i40e_add_vsi()
13977 ctxt.pf_num = pf->hw.pf_id; in i40e_add_vsi()
13979 ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); in i40e_add_vsi()
13982 dev_info(&pf->pdev->dev, in i40e_add_vsi()
13985 i40e_aq_str(&pf->hw, in i40e_add_vsi()
13986 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
13995 enabled_tc = i40e_pf_get_tc_map(pf); in i40e_add_vsi()
14001 if (pf->flags & I40E_FLAG_SOURCE_PRUNING_DISABLED) { in i40e_add_vsi()
14003 ctxt.seid = pf->main_vsi_seid; in i40e_add_vsi()
14004 ctxt.pf_num = pf->hw.pf_id; in i40e_add_vsi()
14012 dev_info(&pf->pdev->dev, in i40e_add_vsi()
14015 i40e_aq_str(&pf->hw, in i40e_add_vsi()
14016 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
14023 if ((pf->flags & I40E_FLAG_MFP_ENABLED) && in i40e_add_vsi()
14024 !(pf->hw.func_caps.iscsi)) { /* NIC type PF */ in i40e_add_vsi()
14026 ctxt.seid = pf->main_vsi_seid; in i40e_add_vsi()
14027 ctxt.pf_num = pf->hw.pf_id; in i40e_add_vsi()
14032 dev_info(&pf->pdev->dev, in i40e_add_vsi()
14035 i40e_aq_str(&pf->hw, in i40e_add_vsi()
14036 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
14055 dev_info(&pf->pdev->dev, in i40e_add_vsi()
14059 i40e_aq_str(&pf->hw, in i40e_add_vsi()
14060 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
14071 if ((pf->flags & I40E_FLAG_VEB_MODE_ENABLED) && in i40e_add_vsi()
14129 if (pf->vf[vsi->vf_id].spoofchk) { in i40e_add_vsi()
14154 i40e_aq_str(&pf->hw, in i40e_add_vsi()
14155 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
14177 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_add_vsi()
14183 dev_info(&pf->pdev->dev, in i40e_add_vsi()
14186 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_vsi()
14206 struct i40e_pf *pf; in i40e_vsi_release() local
14210 pf = vsi->back; in i40e_vsi_release()
14214 dev_info(&pf->pdev->dev, "VSI %d has existing VEB %d\n", in i40e_vsi_release()
14218 if (vsi == pf->vsi[pf->lan_vsi] && in i40e_vsi_release()
14219 !test_bit(__I40E_DOWN, pf->state)) { in i40e_vsi_release()
14220 dev_info(&pf->pdev->dev, "Can't remove PF VSI\n"); in i40e_vsi_release()
14271 for (n = 0, i = 0; i < pf->num_alloc_vsi; i++) { in i40e_vsi_release()
14272 if (pf->vsi[i] && in i40e_vsi_release()
14273 pf->vsi[i]->uplink_seid == uplink_seid && in i40e_vsi_release()
14274 (pf->vsi[i]->flags & I40E_VSI_FLAG_VEB_OWNER) == 0) { in i40e_vsi_release()
14279 if (!pf->veb[i]) in i40e_vsi_release()
14281 if (pf->veb[i]->uplink_seid == uplink_seid) in i40e_vsi_release()
14283 if (pf->veb[i]->seid == uplink_seid) in i40e_vsi_release()
14284 veb = pf->veb[i]; in i40e_vsi_release()
14305 struct i40e_pf *pf = vsi->back; in i40e_vsi_setup_vectors() local
14308 dev_info(&pf->pdev->dev, "VSI %d has existing q_vectors\n", in i40e_vsi_setup_vectors()
14314 dev_info(&pf->pdev->dev, "VSI %d has non-zero base vector %d\n", in i40e_vsi_setup_vectors()
14321 dev_info(&pf->pdev->dev, in i40e_vsi_setup_vectors()
14331 if (!(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_vsi_setup_vectors()
14334 vsi->base_vector = i40e_get_lump(pf, pf->irq_pile, in i40e_vsi_setup_vectors()
14337 dev_info(&pf->pdev->dev, in i40e_vsi_setup_vectors()
14361 struct i40e_pf *pf; in i40e_vsi_reinit_setup() local
14368 pf = vsi->back; in i40e_vsi_reinit_setup()
14370 i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx); in i40e_vsi_reinit_setup()
14382 ret = i40e_get_lump(pf, pf->qp_pile, alloc_queue_pairs, vsi->idx); in i40e_vsi_reinit_setup()
14384 dev_info(&pf->pdev->dev, in i40e_vsi_reinit_setup()
14394 enabled_tc = pf->vsi[pf->lan_vsi]->tc_config.enabled_tc; in i40e_vsi_reinit_setup()
14395 pf->vsi[pf->lan_vsi]->tc_config.enabled_tc = 0; in i40e_vsi_reinit_setup()
14396 pf->vsi[pf->lan_vsi]->seid = pf->main_vsi_seid; in i40e_vsi_reinit_setup()
14397 i40e_vsi_config_tc(pf->vsi[pf->lan_vsi], enabled_tc); in i40e_vsi_reinit_setup()
14399 i40e_rm_default_mac_filter(vsi, pf->hw.mac.perm_addr); in i40e_vsi_reinit_setup()
14418 i40e_aq_delete_element(&pf->hw, vsi->seid, NULL); in i40e_vsi_reinit_setup()
14437 struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type, in i40e_vsi_setup() argument
14460 if (pf->veb[i] && pf->veb[i]->seid == uplink_seid) { in i40e_vsi_setup()
14461 veb = pf->veb[i]; in i40e_vsi_setup()
14466 if (!veb && uplink_seid != pf->mac_seid) { in i40e_vsi_setup()
14468 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_vsi_setup()
14469 if (pf->vsi[i] && pf->vsi[i]->seid == uplink_seid) { in i40e_vsi_setup()
14470 vsi = pf->vsi[i]; in i40e_vsi_setup()
14475 dev_info(&pf->pdev->dev, "no such uplink_seid %d\n", in i40e_vsi_setup()
14480 if (vsi->uplink_seid == pf->mac_seid) in i40e_vsi_setup()
14481 veb = i40e_veb_setup(pf, 0, pf->mac_seid, vsi->seid, in i40e_vsi_setup()
14484 veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid, in i40e_vsi_setup()
14487 if (vsi->seid != pf->vsi[pf->lan_vsi]->seid) { in i40e_vsi_setup()
14496 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_vsi_setup()
14498 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_vsi_setup()
14503 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_vsi_setup()
14504 veb = pf->veb[i]; in i40e_vsi_setup()
14507 dev_info(&pf->pdev->dev, "couldn't add VEB\n"); in i40e_vsi_setup()
14516 v_idx = i40e_vsi_mem_alloc(pf, type); in i40e_vsi_setup()
14519 vsi = pf->vsi[v_idx]; in i40e_vsi_setup()
14526 pf->lan_vsi = v_idx; in i40e_vsi_setup()
14533 ret = i40e_get_lump(pf, pf->qp_pile, alloc_queue_pairs, vsi->idx); in i40e_vsi_setup()
14535 dev_info(&pf->pdev->dev, in i40e_vsi_setup()
14588 if ((pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) && in i40e_vsi_setup()
14604 i40e_aq_delete_element(&pf->hw, vsi->seid, NULL); in i40e_vsi_setup()
14621 struct i40e_pf *pf = veb->pf; in i40e_veb_get_bw_info() local
14622 struct i40e_hw *hw = &pf->hw; in i40e_veb_get_bw_info()
14630 dev_info(&pf->pdev->dev, in i40e_veb_get_bw_info()
14633 i40e_aq_str(&pf->hw, hw->aq.asq_last_status)); in i40e_veb_get_bw_info()
14640 dev_info(&pf->pdev->dev, in i40e_veb_get_bw_info()
14643 i40e_aq_str(&pf->hw, hw->aq.asq_last_status)); in i40e_veb_get_bw_info()
14671 static int i40e_veb_mem_alloc(struct i40e_pf *pf) in i40e_veb_mem_alloc() argument
14678 mutex_lock(&pf->switch_mutex); in i40e_veb_mem_alloc()
14687 while ((i < I40E_MAX_VEB) && (pf->veb[i] != NULL)) in i40e_veb_mem_alloc()
14699 veb->pf = pf; in i40e_veb_mem_alloc()
14703 pf->veb[i] = veb; in i40e_veb_mem_alloc()
14706 mutex_unlock(&pf->switch_mutex); in i40e_veb_mem_alloc()
14719 struct i40e_pf *pf = branch->pf; in i40e_switch_branch_release() local
14726 if (!pf->veb[i]) in i40e_switch_branch_release()
14728 if (pf->veb[i]->uplink_seid == branch->seid) in i40e_switch_branch_release()
14729 i40e_switch_branch_release(pf->veb[i]); in i40e_switch_branch_release()
14737 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_switch_branch_release()
14738 if (!pf->vsi[i]) in i40e_switch_branch_release()
14740 if (pf->vsi[i]->uplink_seid == branch_seid && in i40e_switch_branch_release()
14741 (pf->vsi[i]->flags & I40E_VSI_FLAG_VEB_OWNER) == 0) { in i40e_switch_branch_release()
14742 i40e_vsi_release(pf->vsi[i]); in i40e_switch_branch_release()
14751 if (pf->veb[veb_idx]) in i40e_switch_branch_release()
14752 i40e_veb_release(pf->veb[veb_idx]); in i40e_switch_branch_release()
14764 if (veb->pf) { in i40e_veb_clear()
14765 struct i40e_pf *pf = veb->pf; in i40e_veb_clear() local
14767 mutex_lock(&pf->switch_mutex); in i40e_veb_clear()
14768 if (pf->veb[veb->idx] == veb) in i40e_veb_clear()
14769 pf->veb[veb->idx] = NULL; in i40e_veb_clear()
14770 mutex_unlock(&pf->switch_mutex); in i40e_veb_clear()
14783 struct i40e_pf *pf; in i40e_veb_release() local
14786 pf = veb->pf; in i40e_veb_release()
14789 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_veb_release()
14790 if (pf->vsi[i] && pf->vsi[i]->uplink_seid == veb->seid) { in i40e_veb_release()
14792 vsi = pf->vsi[i]; in i40e_veb_release()
14796 dev_info(&pf->pdev->dev, in i40e_veb_release()
14806 if (veb->uplink_seid == pf->mac_seid) in i40e_veb_release()
14812 vsi->uplink_seid = pf->vsi[pf->lan_vsi]->uplink_seid; in i40e_veb_release()
14813 vsi->veb_idx = pf->vsi[pf->lan_vsi]->veb_idx; in i40e_veb_release()
14816 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_veb_release()
14827 struct i40e_pf *pf = veb->pf; in i40e_add_veb() local
14828 bool enable_stats = !!(pf->flags & I40E_FLAG_VEB_STATS_ENABLED); in i40e_add_veb()
14831 ret = i40e_aq_add_veb(&pf->hw, veb->uplink_seid, vsi->seid, in i40e_add_veb()
14837 dev_info(&pf->pdev->dev, in i40e_add_veb()
14840 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_veb()
14845 ret = i40e_aq_get_veb_parameters(&pf->hw, veb->seid, NULL, NULL, in i40e_add_veb()
14848 dev_info(&pf->pdev->dev, in i40e_add_veb()
14851 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_veb()
14856 dev_info(&pf->pdev->dev, in i40e_add_veb()
14859 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_veb()
14860 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_add_veb()
14887 struct i40e_veb *i40e_veb_setup(struct i40e_pf *pf, u16 flags, in i40e_veb_setup() argument
14898 dev_info(&pf->pdev->dev, in i40e_veb_setup()
14905 for (vsi_idx = 0; vsi_idx < pf->num_alloc_vsi; vsi_idx++) in i40e_veb_setup()
14906 if (pf->vsi[vsi_idx] && pf->vsi[vsi_idx]->seid == vsi_seid) in i40e_veb_setup()
14908 if (vsi_idx == pf->num_alloc_vsi && vsi_seid != 0) { in i40e_veb_setup()
14909 dev_info(&pf->pdev->dev, "vsi seid %d not found\n", in i40e_veb_setup()
14914 if (uplink_seid && uplink_seid != pf->mac_seid) { in i40e_veb_setup()
14916 if (pf->veb[veb_idx] && in i40e_veb_setup()
14917 pf->veb[veb_idx]->seid == uplink_seid) { in i40e_veb_setup()
14918 uplink_veb = pf->veb[veb_idx]; in i40e_veb_setup()
14923 dev_info(&pf->pdev->dev, in i40e_veb_setup()
14930 veb_idx = i40e_veb_mem_alloc(pf); in i40e_veb_setup()
14933 veb = pf->veb[veb_idx]; in i40e_veb_setup()
14940 ret = i40e_add_veb(veb, pf->vsi[vsi_idx]); in i40e_veb_setup()
14943 if (vsi_idx == pf->lan_vsi) in i40e_veb_setup()
14944 pf->lan_veb = veb->idx; in i40e_veb_setup()
14963 static void i40e_setup_pf_switch_element(struct i40e_pf *pf, in i40e_setup_pf_switch_element() argument
14973 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch_element()
14979 pf->mac_seid = seid; in i40e_setup_pf_switch_element()
14983 if (uplink_seid != pf->mac_seid) in i40e_setup_pf_switch_element()
14985 if (pf->lan_veb >= I40E_MAX_VEB) { in i40e_setup_pf_switch_element()
14990 if (pf->veb[v] && (pf->veb[v]->seid == seid)) { in i40e_setup_pf_switch_element()
14991 pf->lan_veb = v; in i40e_setup_pf_switch_element()
14995 if (pf->lan_veb >= I40E_MAX_VEB) { in i40e_setup_pf_switch_element()
14996 v = i40e_veb_mem_alloc(pf); in i40e_setup_pf_switch_element()
14999 pf->lan_veb = v; in i40e_setup_pf_switch_element()
15002 if (pf->lan_veb >= I40E_MAX_VEB) in i40e_setup_pf_switch_element()
15005 pf->veb[pf->lan_veb]->seid = seid; in i40e_setup_pf_switch_element()
15006 pf->veb[pf->lan_veb]->uplink_seid = pf->mac_seid; in i40e_setup_pf_switch_element()
15007 pf->veb[pf->lan_veb]->pf = pf; in i40e_setup_pf_switch_element()
15008 pf->veb[pf->lan_veb]->veb_idx = I40E_NO_VEB; in i40e_setup_pf_switch_element()
15016 pf->mac_seid = uplink_seid; in i40e_setup_pf_switch_element()
15017 pf->pf_seid = downlink_seid; in i40e_setup_pf_switch_element()
15018 pf->main_vsi_seid = seid; in i40e_setup_pf_switch_element()
15020 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch_element()
15022 pf->pf_seid, pf->main_vsi_seid); in i40e_setup_pf_switch_element()
15033 dev_info(&pf->pdev->dev, "unknown element type=%d seid=%d\n", in i40e_setup_pf_switch_element()
15047 int i40e_fetch_switch_configuration(struct i40e_pf *pf, bool printconfig) in i40e_fetch_switch_configuration() argument
15063 ret = i40e_aq_get_switch_config(&pf->hw, sw_config, in i40e_fetch_switch_configuration()
15067 dev_info(&pf->pdev->dev, in i40e_fetch_switch_configuration()
15070 i40e_aq_str(&pf->hw, in i40e_fetch_switch_configuration()
15071 pf->hw.aq.asq_last_status)); in i40e_fetch_switch_configuration()
15080 dev_info(&pf->pdev->dev, in i40e_fetch_switch_configuration()
15088 i40e_setup_pf_switch_element(pf, ele, num_reported, in i40e_fetch_switch_configuration()
15105 static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit, bool lock_acquired) in i40e_setup_pf_switch() argument
15111 ret = i40e_fetch_switch_configuration(pf, false); in i40e_setup_pf_switch()
15113 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch()
15116 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_setup_pf_switch()
15119 i40e_pf_reset_stats(pf); in i40e_setup_pf_switch()
15127 if ((pf->hw.pf_id == 0) && in i40e_setup_pf_switch()
15128 !(pf->flags & I40E_FLAG_TRUE_PROMISC_SUPPORT)) { in i40e_setup_pf_switch()
15130 pf->last_sw_conf_flags = flags; in i40e_setup_pf_switch()
15133 if (pf->hw.pf_id == 0) { in i40e_setup_pf_switch()
15137 ret = i40e_aq_set_switch_config(&pf->hw, flags, valid_flags, 0, in i40e_setup_pf_switch()
15139 if (ret && pf->hw.aq.asq_last_status != I40E_AQ_RC_ESRCH) { in i40e_setup_pf_switch()
15140 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch()
15143 i40e_aq_str(&pf->hw, in i40e_setup_pf_switch()
15144 pf->hw.aq.asq_last_status)); in i40e_setup_pf_switch()
15147 pf->last_sw_conf_valid_flags = valid_flags; in i40e_setup_pf_switch()
15151 if (pf->lan_vsi == I40E_NO_VSI || reinit) { in i40e_setup_pf_switch()
15158 if (pf->lan_veb < I40E_MAX_VEB && pf->veb[pf->lan_veb]) in i40e_setup_pf_switch()
15159 uplink_seid = pf->veb[pf->lan_veb]->seid; in i40e_setup_pf_switch()
15161 uplink_seid = pf->mac_seid; in i40e_setup_pf_switch()
15162 if (pf->lan_vsi == I40E_NO_VSI) in i40e_setup_pf_switch()
15163 vsi = i40e_vsi_setup(pf, I40E_VSI_MAIN, uplink_seid, 0); in i40e_setup_pf_switch()
15165 vsi = i40e_vsi_reinit_setup(pf->vsi[pf->lan_vsi]); in i40e_setup_pf_switch()
15167 dev_info(&pf->pdev->dev, "setup of MAIN VSI failed\n"); in i40e_setup_pf_switch()
15168 i40e_cloud_filter_exit(pf); in i40e_setup_pf_switch()
15169 i40e_fdir_teardown(pf); in i40e_setup_pf_switch()
15174 u8 enabled_tc = pf->vsi[pf->lan_vsi]->tc_config.enabled_tc; in i40e_setup_pf_switch()
15176 pf->vsi[pf->lan_vsi]->tc_config.enabled_tc = 0; in i40e_setup_pf_switch()
15177 pf->vsi[pf->lan_vsi]->seid = pf->main_vsi_seid; in i40e_setup_pf_switch()
15178 i40e_vsi_config_tc(pf->vsi[pf->lan_vsi], enabled_tc); in i40e_setup_pf_switch()
15180 i40e_vlan_stripping_disable(pf->vsi[pf->lan_vsi]); in i40e_setup_pf_switch()
15182 i40e_fdir_sb_setup(pf); in i40e_setup_pf_switch()
15185 ret = i40e_setup_pf_filter_control(pf); in i40e_setup_pf_switch()
15187 dev_info(&pf->pdev->dev, "setup_pf_filter_control failed: %d\n", in i40e_setup_pf_switch()
15195 if ((pf->flags & I40E_FLAG_RSS_ENABLED)) in i40e_setup_pf_switch()
15196 i40e_pf_config_rss(pf); in i40e_setup_pf_switch()
15199 i40e_link_event(pf); in i40e_setup_pf_switch()
15202 pf->fc_autoneg_status = ((pf->hw.phy.link_info.an_info & in i40e_setup_pf_switch()
15205 i40e_ptp_init(pf); in i40e_setup_pf_switch()
15211 udp_tunnel_nic_reset_ntf(pf->vsi[pf->lan_vsi]->netdev); in i40e_setup_pf_switch()
15223 static void i40e_determine_queue_usage(struct i40e_pf *pf) in i40e_determine_queue_usage() argument
15228 pf->num_lan_qps = 0; in i40e_determine_queue_usage()
15234 queues_left = pf->hw.func_caps.num_tx_qp; in i40e_determine_queue_usage()
15237 !(pf->flags & I40E_FLAG_MSIX_ENABLED)) { in i40e_determine_queue_usage()
15240 pf->alloc_rss_size = pf->num_lan_qps = 1; in i40e_determine_queue_usage()
15243 pf->flags &= ~(I40E_FLAG_RSS_ENABLED | in i40e_determine_queue_usage()
15251 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_determine_queue_usage()
15252 } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | in i40e_determine_queue_usage()
15257 pf->alloc_rss_size = pf->num_lan_qps = 1; in i40e_determine_queue_usage()
15258 queues_left -= pf->num_lan_qps; in i40e_determine_queue_usage()
15260 pf->flags &= ~(I40E_FLAG_RSS_ENABLED | in i40e_determine_queue_usage()
15266 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_determine_queue_usage()
15269 if ((pf->flags & I40E_FLAG_DCB_CAPABLE) && in i40e_determine_queue_usage()
15271 pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | in i40e_determine_queue_usage()
15273 dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); in i40e_determine_queue_usage()
15277 q_max = max_t(int, pf->rss_size_max, num_online_cpus()); in i40e_determine_queue_usage()
15278 q_max = min_t(int, q_max, pf->hw.func_caps.num_tx_qp); in i40e_determine_queue_usage()
15279 q_max = min_t(int, q_max, pf->hw.func_caps.num_msix_vectors); in i40e_determine_queue_usage()
15280 pf->num_lan_qps = q_max; in i40e_determine_queue_usage()
15282 queues_left -= pf->num_lan_qps; in i40e_determine_queue_usage()
15285 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_determine_queue_usage()
15289 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; in i40e_determine_queue_usage()
15290 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_determine_queue_usage()
15291 …dev_info(&pf->pdev->dev, "not enough queues for Flow Director. Flow Director feature is disabled\n… in i40e_determine_queue_usage()
15295 if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) && in i40e_determine_queue_usage()
15296 pf->num_vf_qps && pf->num_req_vfs && queues_left) { in i40e_determine_queue_usage()
15297 pf->num_req_vfs = min_t(int, pf->num_req_vfs, in i40e_determine_queue_usage()
15298 (queues_left / pf->num_vf_qps)); in i40e_determine_queue_usage()
15299 queues_left -= (pf->num_req_vfs * pf->num_vf_qps); in i40e_determine_queue_usage()
15302 if ((pf->flags & I40E_FLAG_VMDQ_ENABLED) && in i40e_determine_queue_usage()
15303 pf->num_vmdq_vsis && pf->num_vmdq_qps && queues_left) { in i40e_determine_queue_usage()
15304 pf->num_vmdq_vsis = min_t(int, pf->num_vmdq_vsis, in i40e_determine_queue_usage()
15305 (queues_left / pf->num_vmdq_qps)); in i40e_determine_queue_usage()
15306 queues_left -= (pf->num_vmdq_vsis * pf->num_vmdq_qps); in i40e_determine_queue_usage()
15309 pf->queues_left = queues_left; in i40e_determine_queue_usage()
15310 dev_dbg(&pf->pdev->dev, in i40e_determine_queue_usage()
15312 pf->hw.func_caps.num_tx_qp, in i40e_determine_queue_usage()
15313 !!(pf->flags & I40E_FLAG_FD_SB_ENABLED), in i40e_determine_queue_usage()
15314 pf->num_lan_qps, pf->alloc_rss_size, pf->num_req_vfs, in i40e_determine_queue_usage()
15315 pf->num_vf_qps, pf->num_vmdq_vsis, pf->num_vmdq_qps, in i40e_determine_queue_usage()
15330 static int i40e_setup_pf_filter_control(struct i40e_pf *pf) in i40e_setup_pf_filter_control() argument
15332 struct i40e_filter_control_settings *settings = &pf->filter_settings; in i40e_setup_pf_filter_control()
15337 if (pf->flags & (I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_ATR_ENABLED)) in i40e_setup_pf_filter_control()
15344 if (i40e_set_filter_control(&pf->hw, settings)) in i40e_setup_pf_filter_control()
15352 static void i40e_print_features(struct i40e_pf *pf) in i40e_print_features() argument
15354 struct i40e_hw *hw = &pf->hw; in i40e_print_features()
15364 i += scnprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs); in i40e_print_features()
15367 pf->hw.func_caps.num_vsis, in i40e_print_features()
15368 pf->vsi[pf->lan_vsi]->num_queue_pairs); in i40e_print_features()
15369 if (pf->flags & I40E_FLAG_RSS_ENABLED) in i40e_print_features()
15371 if (pf->flags & I40E_FLAG_FD_ATR_ENABLED) in i40e_print_features()
15373 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_print_features()
15377 if (pf->flags & I40E_FLAG_DCB_CAPABLE) in i40e_print_features()
15381 if (pf->flags & I40E_FLAG_PTP) in i40e_print_features()
15383 if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED) in i40e_print_features()
15388 dev_info(&pf->pdev->dev, "%s\n", buf); in i40e_print_features()
15403 static void i40e_get_platform_mac_addr(struct pci_dev *pdev, struct i40e_pf *pf) in i40e_get_platform_mac_addr() argument
15405 if (eth_platform_get_mac_address(&pdev->dev, pf->hw.mac.addr)) in i40e_get_platform_mac_addr()
15406 i40e_get_mac_addr(&pf->hw, pf->hw.mac.addr); in i40e_get_platform_mac_addr()
15441 static bool i40e_check_recovery_mode(struct i40e_pf *pf) in i40e_check_recovery_mode() argument
15443 u32 val = rd32(&pf->hw, I40E_GL_FWSTS); in i40e_check_recovery_mode()
15446 dev_crit(&pf->pdev->dev, "Firmware recovery mode detected. Limiting functionality.\n"); in i40e_check_recovery_mode()
15447 …dev_crit(&pf->pdev->dev, "Refer to the Intel(R) Ethernet Adapters and Devices User Guide for detai… in i40e_check_recovery_mode()
15448 set_bit(__I40E_RECOVERY_MODE, pf->state); in i40e_check_recovery_mode()
15452 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_check_recovery_mode()
15453 …dev_info(&pf->pdev->dev, "Please do Power-On Reset to initialize adapter in normal mode with full … in i40e_check_recovery_mode()
15479 static int i40e_pf_loop_reset(struct i40e_pf *pf) in i40e_pf_loop_reset() argument
15483 struct i40e_hw *hw = &pf->hw; in i40e_pf_loop_reset()
15493 pf->pfr_count++; in i40e_pf_loop_reset()
15495 dev_info(&pf->pdev->dev, "PF reset failed: %d\n", ret); in i40e_pf_loop_reset()
15511 static bool i40e_check_fw_empr(struct i40e_pf *pf) in i40e_check_fw_empr() argument
15513 const u32 fw_sts = rd32(&pf->hw, I40E_GL_FWSTS) & in i40e_check_fw_empr()
15530 static int i40e_handle_resets(struct i40e_pf *pf) in i40e_handle_resets() argument
15532 const int pfr = i40e_pf_loop_reset(pf); in i40e_handle_resets()
15533 const bool is_empr = i40e_check_fw_empr(pf); in i40e_handle_resets()
15536 …dev_crit(&pf->pdev->dev, "Entering recovery mode due to repeated FW resets. This may take several … in i40e_handle_resets()
15551 static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw) in i40e_init_recovery_mode() argument
15557 pci_set_drvdata(pf->pdev, pf); in i40e_init_recovery_mode()
15558 pci_save_state(pf->pdev); in i40e_init_recovery_mode()
15561 timer_setup(&pf->service_timer, i40e_service_timer, 0); in i40e_init_recovery_mode()
15562 pf->service_timer_period = HZ; in i40e_init_recovery_mode()
15564 INIT_WORK(&pf->service_task, i40e_service_task); in i40e_init_recovery_mode()
15565 clear_bit(__I40E_SERVICE_SCHED, pf->state); in i40e_init_recovery_mode()
15567 err = i40e_init_interrupt_scheme(pf); in i40e_init_recovery_mode()
15576 if (pf->hw.func_caps.num_vsis < I40E_MIN_VSI_ALLOC) in i40e_init_recovery_mode()
15577 pf->num_alloc_vsi = I40E_MIN_VSI_ALLOC; in i40e_init_recovery_mode()
15579 pf->num_alloc_vsi = pf->hw.func_caps.num_vsis; in i40e_init_recovery_mode()
15582 pf->vsi = kcalloc(pf->num_alloc_vsi, sizeof(struct i40e_vsi *), in i40e_init_recovery_mode()
15584 if (!pf->vsi) { in i40e_init_recovery_mode()
15592 v_idx = i40e_vsi_mem_alloc(pf, I40E_VSI_MAIN); in i40e_init_recovery_mode()
15597 pf->lan_vsi = v_idx; in i40e_init_recovery_mode()
15598 vsi = pf->vsi[v_idx]; in i40e_init_recovery_mode()
15611 i40e_dbg_pf_init(pf); in i40e_init_recovery_mode()
15613 err = i40e_setup_misc_vector_for_recovery_mode(pf); in i40e_init_recovery_mode()
15618 i40e_send_version(pf); in i40e_init_recovery_mode()
15621 mod_timer(&pf->service_timer, in i40e_init_recovery_mode()
15622 round_jiffies(jiffies + pf->service_timer_period)); in i40e_init_recovery_mode()
15627 i40e_reset_interrupt_capability(pf); in i40e_init_recovery_mode()
15628 timer_shutdown_sync(&pf->service_timer); in i40e_init_recovery_mode()
15631 pci_release_mem_regions(pf->pdev); in i40e_init_recovery_mode()
15632 pci_disable_device(pf->pdev); in i40e_init_recovery_mode()
15633 kfree(pf); in i40e_init_recovery_mode()
15671 struct i40e_pf *pf; in i40e_probe() local
15710 pf = kzalloc(sizeof(*pf), GFP_KERNEL); in i40e_probe()
15711 if (!pf) { in i40e_probe()
15715 pf->next_vsi = 0; in i40e_probe()
15716 pf->pdev = pdev; in i40e_probe()
15717 set_bit(__I40E_DOWN, pf->state); in i40e_probe()
15719 hw = &pf->hw; in i40e_probe()
15720 hw->back = pf; in i40e_probe()
15722 pf->ioremap_len = min_t(int, pci_resource_len(pdev, 0), in i40e_probe()
15729 if (pf->ioremap_len < I40E_GLGEN_STAT_CLEAR) { in i40e_probe()
15731 pf->ioremap_len); in i40e_probe()
15735 hw->hw_addr = ioremap(pci_resource_start(pdev, 0), pf->ioremap_len); in i40e_probe()
15740 pf->ioremap_len, err); in i40e_probe()
15751 pf->instance = pfs_found; in i40e_probe()
15760 INIT_LIST_HEAD(&pf->l3_flex_pit_list); in i40e_probe()
15761 INIT_LIST_HEAD(&pf->l4_flex_pit_list); in i40e_probe()
15762 INIT_LIST_HEAD(&pf->ddp_old_prof); in i40e_probe()
15770 pf->msg_enable = netif_msg_init(debug, in i40e_probe()
15775 pf->hw.debug_mask = debug; in i40e_probe()
15783 pf->corer_count++; in i40e_probe()
15798 err = i40e_handle_resets(pf); in i40e_probe()
15802 i40e_check_recovery_mode(pf); in i40e_probe()
15813 pf->adminq_work_limit = I40E_AQ_WORK_LIMIT; in i40e_probe()
15815 snprintf(pf->int_name, sizeof(pf->int_name) - 1, in i40e_probe()
15817 dev_driver_string(&pf->pdev->dev), dev_name(&pdev->dev)); in i40e_probe()
15827 pf->hw.fc.requested_mode = I40E_FC_NONE; in i40e_probe()
15869 i40e_verify_eeprom(pf); in i40e_probe()
15877 err = i40e_get_capabilities(pf, i40e_aqc_opc_list_func_capabilities); in i40e_probe()
15881 err = i40e_sw_init(pf); in i40e_probe()
15887 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_probe()
15888 return i40e_init_recovery_mode(pf, hw); in i40e_probe()
15908 if (pf->hw_features & I40E_HW_STOP_FW_LLDP) { in i40e_probe()
15914 i40e_get_platform_mac_addr(pdev, pf); in i40e_probe()
15925 pf->hw_features |= I40E_HW_PORT_ID_VALID; in i40e_probe()
15927 i40e_ptp_alloc_pins(pf); in i40e_probe()
15928 pci_set_drvdata(pdev, pf); in i40e_probe()
15932 status = i40e_get_fw_lldp_status(&pf->hw, &lldp_status); in i40e_probe()
15935 (pf->flags &= ~I40E_FLAG_DISABLE_FW_LLDP) : in i40e_probe()
15936 (pf->flags |= I40E_FLAG_DISABLE_FW_LLDP); in i40e_probe()
15938 (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) ? in i40e_probe()
15945 err = i40e_init_pf_dcb(pf); in i40e_probe()
15948 pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | I40E_FLAG_DCB_ENABLED); in i40e_probe()
15954 timer_setup(&pf->service_timer, i40e_service_timer, 0); in i40e_probe()
15955 pf->service_timer_period = HZ; in i40e_probe()
15957 INIT_WORK(&pf->service_task, i40e_service_task); in i40e_probe()
15958 clear_bit(__I40E_SERVICE_SCHED, pf->state); in i40e_probe()
15963 pf->wol_en = false; in i40e_probe()
15965 pf->wol_en = true; in i40e_probe()
15966 device_set_wakeup_enable(&pf->pdev->dev, pf->wol_en); in i40e_probe()
15969 i40e_determine_queue_usage(pf); in i40e_probe()
15970 err = i40e_init_interrupt_scheme(pf); in i40e_probe()
15980 pf->num_lan_msix = 1; in i40e_probe()
15982 pf->udp_tunnel_nic.set_port = i40e_udp_tunnel_set_port; in i40e_probe()
15983 pf->udp_tunnel_nic.unset_port = i40e_udp_tunnel_unset_port; in i40e_probe()
15984 pf->udp_tunnel_nic.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP; in i40e_probe()
15985 pf->udp_tunnel_nic.shared = &pf->udp_tunnel_shared; in i40e_probe()
15986 pf->udp_tunnel_nic.tables[0].n_entries = I40E_MAX_PF_UDP_OFFLOAD_PORTS; in i40e_probe()
15987 pf->udp_tunnel_nic.tables[0].tunnel_types = UDP_TUNNEL_TYPE_VXLAN | in i40e_probe()
15995 if (pf->hw.func_caps.num_vsis < I40E_MIN_VSI_ALLOC) in i40e_probe()
15996 pf->num_alloc_vsi = I40E_MIN_VSI_ALLOC; in i40e_probe()
15998 pf->num_alloc_vsi = pf->hw.func_caps.num_vsis; in i40e_probe()
15999 if (pf->num_alloc_vsi > UDP_TUNNEL_NIC_MAX_SHARING_DEVICES) { in i40e_probe()
16000 dev_warn(&pf->pdev->dev, in i40e_probe()
16002 pf->num_alloc_vsi, UDP_TUNNEL_NIC_MAX_SHARING_DEVICES); in i40e_probe()
16003 pf->num_alloc_vsi = UDP_TUNNEL_NIC_MAX_SHARING_DEVICES; in i40e_probe()
16007 pf->vsi = kcalloc(pf->num_alloc_vsi, sizeof(struct i40e_vsi *), in i40e_probe()
16009 if (!pf->vsi) { in i40e_probe()
16016 if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) && in i40e_probe()
16017 (pf->flags & I40E_FLAG_MSIX_ENABLED) && in i40e_probe()
16018 !test_bit(__I40E_BAD_EEPROM, pf->state)) { in i40e_probe()
16020 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_probe()
16023 err = i40e_setup_pf_switch(pf, false, false); in i40e_probe()
16028 INIT_LIST_HEAD(&pf->vsi[pf->lan_vsi]->ch_list); in i40e_probe()
16031 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_probe()
16032 if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) { in i40e_probe()
16033 i40e_vsi_open(pf->vsi[i]); in i40e_probe()
16041 err = i40e_aq_set_phy_int_mask(&pf->hw, in i40e_probe()
16046 dev_info(&pf->pdev->dev, "set phy mask fail, err %pe aq_err %s\n", in i40e_probe()
16048 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_probe()
16061 if (pf->hw_features & I40E_HW_RESTART_AUTONEG) { in i40e_probe()
16063 err = i40e_aq_set_link_restart_an(&pf->hw, true, NULL); in i40e_probe()
16065 dev_info(&pf->pdev->dev, "link restart failed, err %pe aq_err %s\n", in i40e_probe()
16067 i40e_aq_str(&pf->hw, in i40e_probe()
16068 pf->hw.aq.asq_last_status)); in i40e_probe()
16074 clear_bit(__I40E_DOWN, pf->state); in i40e_probe()
16081 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_probe()
16082 err = i40e_setup_misc_vector(pf); in i40e_probe()
16086 i40e_cloud_filter_exit(pf); in i40e_probe()
16087 i40e_fdir_teardown(pf); in i40e_probe()
16094 if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) && in i40e_probe()
16095 (pf->flags & I40E_FLAG_MSIX_ENABLED) && in i40e_probe()
16096 !test_bit(__I40E_BAD_EEPROM, pf->state)) { in i40e_probe()
16106 err = i40e_alloc_vfs(pf, pci_num_vf(pdev)); in i40e_probe()
16115 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_probe()
16116 pf->iwarp_base_vector = i40e_get_lump(pf, pf->irq_pile, in i40e_probe()
16117 pf->num_iwarp_msix, in i40e_probe()
16119 if (pf->iwarp_base_vector < 0) { in i40e_probe()
16122 pf->num_iwarp_msix, pf->iwarp_base_vector); in i40e_probe()
16123 pf->flags &= ~I40E_FLAG_IWARP_ENABLED; in i40e_probe()
16127 i40e_dbg_pf_init(pf); in i40e_probe()
16130 i40e_send_version(pf); in i40e_probe()
16133 mod_timer(&pf->service_timer, in i40e_probe()
16134 round_jiffies(jiffies + pf->service_timer_period)); in i40e_probe()
16137 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_probe()
16138 err = i40e_lan_add_device(pf); in i40e_probe()
16150 if (!(pf->hw_features & I40E_HW_NO_PCI_LINK_CHECK)) { in i40e_probe()
16157 pcie_capability_read_word(pf->pdev, PCI_EXP_LNKSTA, in i40e_probe()
16198 dev_dbg(&pf->pdev->dev, "get requested speeds ret = %pe last_status = %s\n", in i40e_probe()
16200 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_probe()
16201 pf->hw.phy.link_info.requested_speeds = abilities.link_speed; in i40e_probe()
16204 i40e_set_fec_in_flags(abilities.fec_cfg_curr_mod_ext_info, &pf->flags); in i40e_probe()
16209 dev_dbg(&pf->pdev->dev, "get supported phy types ret = %pe last_status = %s\n", in i40e_probe()
16211 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_probe()
16215 val = (rd32(&pf->hw, I40E_PRTGL_SAH) & in i40e_probe()
16219 pf->hw.port, val); in i40e_probe()
16227 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, in i40e_probe()
16228 pf->main_vsi_seid); in i40e_probe()
16230 if ((pf->hw.device_id == I40E_DEV_ID_10G_BASE_T) || in i40e_probe()
16231 (pf->hw.device_id == I40E_DEV_ID_10G_BASE_T4)) in i40e_probe()
16232 pf->hw_features |= I40E_HW_PHY_CONTROLS_LEDS; in i40e_probe()
16233 if (pf->hw.device_id == I40E_DEV_ID_SFP_I_X722) in i40e_probe()
16234 pf->hw_features |= I40E_HW_HAVE_CRT_RETIMER; in i40e_probe()
16236 i40e_print_features(pf); in i40e_probe()
16242 set_bit(__I40E_DOWN, pf->state); in i40e_probe()
16243 i40e_clear_interrupt_scheme(pf); in i40e_probe()
16244 kfree(pf->vsi); in i40e_probe()
16246 i40e_reset_interrupt_capability(pf); in i40e_probe()
16247 timer_shutdown_sync(&pf->service_timer); in i40e_probe()
16252 kfree(pf->qp_pile); in i40e_probe()
16258 kfree(pf); in i40e_probe()
16278 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_remove() local
16279 struct i40e_hw *hw = &pf->hw; in i40e_remove()
16283 i40e_dbg_pf_exit(pf); in i40e_remove()
16285 i40e_ptp_stop(pf); in i40e_remove()
16295 while (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_remove()
16297 set_bit(__I40E_IN_REMOVE, pf->state); in i40e_remove()
16299 if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { in i40e_remove()
16300 set_bit(__I40E_VF_RESETS_DISABLED, pf->state); in i40e_remove()
16301 i40e_free_vfs(pf); in i40e_remove()
16302 pf->flags &= ~I40E_FLAG_SRIOV_ENABLED; in i40e_remove()
16305 set_bit(__I40E_SUSPENDED, pf->state); in i40e_remove()
16306 set_bit(__I40E_DOWN, pf->state); in i40e_remove()
16307 if (pf->service_timer.function) in i40e_remove()
16308 timer_shutdown_sync(&pf->service_timer); in i40e_remove()
16309 if (pf->service_task.func) in i40e_remove()
16310 cancel_work_sync(&pf->service_task); in i40e_remove()
16312 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_remove()
16313 struct i40e_vsi *vsi = pf->vsi[0]; in i40e_remove()
16328 i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false); in i40e_remove()
16330 i40e_fdir_teardown(pf); in i40e_remove()
16336 if (!pf->veb[i]) in i40e_remove()
16339 if (pf->veb[i]->uplink_seid == pf->mac_seid || in i40e_remove()
16340 pf->veb[i]->uplink_seid == 0) in i40e_remove()
16341 i40e_switch_branch_release(pf->veb[i]); in i40e_remove()
16347 for (i = pf->num_alloc_vsi; i--;) in i40e_remove()
16348 if (pf->vsi[i]) { in i40e_remove()
16349 i40e_vsi_close(pf->vsi[i]); in i40e_remove()
16350 i40e_vsi_release(pf->vsi[i]); in i40e_remove()
16351 pf->vsi[i] = NULL; in i40e_remove()
16354 i40e_cloud_filter_exit(pf); in i40e_remove()
16357 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_remove()
16358 ret_code = i40e_lan_del_device(pf); in i40e_remove()
16375 if (test_bit(__I40E_RECOVERY_MODE, pf->state) && in i40e_remove()
16376 !(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_remove()
16377 free_irq(pf->pdev->irq, pf); in i40e_remove()
16388 i40e_clear_interrupt_scheme(pf); in i40e_remove()
16389 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_remove()
16390 if (pf->vsi[i]) { in i40e_remove()
16391 if (!test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_remove()
16392 i40e_vsi_clear_rings(pf->vsi[i]); in i40e_remove()
16393 i40e_vsi_clear(pf->vsi[i]); in i40e_remove()
16394 pf->vsi[i] = NULL; in i40e_remove()
16400 kfree(pf->veb[i]); in i40e_remove()
16401 pf->veb[i] = NULL; in i40e_remove()
16404 kfree(pf->qp_pile); in i40e_remove()
16405 kfree(pf->vsi); in i40e_remove()
16408 kfree(pf); in i40e_remove()
16426 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_detected() local
16430 if (!pf) { in i40e_pci_error_detected()
16437 if (!test_bit(__I40E_SUSPENDED, pf->state)) in i40e_pci_error_detected()
16438 i40e_prep_for_reset(pf); in i40e_pci_error_detected()
16455 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_slot_reset() local
16470 reg = rd32(&pf->hw, I40E_GLGEN_RTRIG); in i40e_pci_error_slot_reset()
16486 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_reset_prepare() local
16488 i40e_prep_for_reset(pf); in i40e_pci_error_reset_prepare()
16497 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_reset_done() local
16499 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_pci_error_reset_done()
16502 i40e_reset_and_rebuild(pf, false, false); in i40e_pci_error_reset_done()
16517 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_resume() local
16520 if (test_bit(__I40E_SUSPENDED, pf->state)) in i40e_pci_error_resume()
16523 i40e_handle_reset_warning(pf, false); in i40e_pci_error_resume()
16531 static void i40e_enable_mc_magic_wake(struct i40e_pf *pf) in i40e_enable_mc_magic_wake() argument
16533 struct i40e_hw *hw = &pf->hw; in i40e_enable_mc_magic_wake()
16539 if (pf->vsi[pf->lan_vsi] && pf->vsi[pf->lan_vsi]->netdev) { in i40e_enable_mc_magic_wake()
16541 pf->vsi[pf->lan_vsi]->netdev->dev_addr); in i40e_enable_mc_magic_wake()
16543 dev_err(&pf->pdev->dev, in i40e_enable_mc_magic_wake()
16559 dev_err(&pf->pdev->dev, in i40e_enable_mc_magic_wake()
16569 dev_err(&pf->pdev->dev, in i40e_enable_mc_magic_wake()
16579 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_shutdown() local
16580 struct i40e_hw *hw = &pf->hw; in i40e_shutdown()
16582 set_bit(__I40E_SUSPENDED, pf->state); in i40e_shutdown()
16583 set_bit(__I40E_DOWN, pf->state); in i40e_shutdown()
16585 del_timer_sync(&pf->service_timer); in i40e_shutdown()
16586 cancel_work_sync(&pf->service_task); in i40e_shutdown()
16587 i40e_cloud_filter_exit(pf); in i40e_shutdown()
16588 i40e_fdir_teardown(pf); in i40e_shutdown()
16593 i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false); in i40e_shutdown()
16595 if (pf->wol_en && (pf->hw_features & I40E_HW_WOL_MC_MAGIC_PKT_WAKE)) in i40e_shutdown()
16596 i40e_enable_mc_magic_wake(pf); in i40e_shutdown()
16598 i40e_prep_for_reset(pf); in i40e_shutdown()
16601 (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); in i40e_shutdown()
16603 (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); in i40e_shutdown()
16606 if (test_bit(__I40E_RECOVERY_MODE, pf->state) && in i40e_shutdown()
16607 !(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_shutdown()
16608 free_irq(pf->pdev->irq, pf); in i40e_shutdown()
16615 i40e_clear_interrupt_scheme(pf); in i40e_shutdown()
16619 pci_wake_from_d3(pdev, pf->wol_en); in i40e_shutdown()
16630 struct i40e_pf *pf = dev_get_drvdata(dev); in i40e_suspend() local
16631 struct i40e_hw *hw = &pf->hw; in i40e_suspend()
16634 if (test_and_set_bit(__I40E_SUSPENDED, pf->state)) in i40e_suspend()
16637 set_bit(__I40E_DOWN, pf->state); in i40e_suspend()
16640 del_timer_sync(&pf->service_timer); in i40e_suspend()
16641 cancel_work_sync(&pf->service_task); in i40e_suspend()
16646 i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false); in i40e_suspend()
16648 if (pf->wol_en && (pf->hw_features & I40E_HW_WOL_MC_MAGIC_PKT_WAKE)) in i40e_suspend()
16649 i40e_enable_mc_magic_wake(pf); in i40e_suspend()
16657 i40e_prep_for_reset(pf); in i40e_suspend()
16659 wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); in i40e_suspend()
16660 wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); in i40e_suspend()
16667 i40e_clear_interrupt_scheme(pf); in i40e_suspend()
16680 struct i40e_pf *pf = dev_get_drvdata(dev); in i40e_resume() local
16684 if (!test_bit(__I40E_SUSPENDED, pf->state)) in i40e_resume()
16695 err = i40e_restore_interrupt_scheme(pf); in i40e_resume()
16701 clear_bit(__I40E_DOWN, pf->state); in i40e_resume()
16702 i40e_reset_and_rebuild(pf, false, true); in i40e_resume()
16707 clear_bit(__I40E_SUSPENDED, pf->state); in i40e_resume()
16710 mod_timer(&pf->service_timer, in i40e_resume()
16711 round_jiffies(jiffies + pf->service_timer_period)); in i40e_resume()