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);
131 struct i40e_pf *pf = (struct i40e_pf *)hw->back; in i40e_allocate_dma_mem_d() local
134 mem->va = dma_alloc_coherent(&pf->pdev->dev, mem->size, &mem->pa, in i40e_allocate_dma_mem_d()
149 struct i40e_pf *pf = (struct i40e_pf *)hw->back; in i40e_free_dma_mem_d() local
151 dma_free_coherent(&pf->pdev->dev, mem->size, mem->va, mem->pa); in i40e_free_dma_mem_d()
201 static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, in i40e_get_lump() argument
208 dev_info(&pf->pdev->dev, in i40e_get_lump()
217 if (pile == pf->qp_pile && pf->vsi[id]->type == I40E_VSI_FDIR) { in i40e_get_lump()
219 dev_err(&pf->pdev->dev, in i40e_get_lump()
290 struct i40e_vsi *i40e_find_vsi_from_id(struct i40e_pf *pf, u16 id) in i40e_find_vsi_from_id() argument
294 for (i = 0; i < pf->num_alloc_vsi; i++) in i40e_find_vsi_from_id()
295 if (pf->vsi[i] && (pf->vsi[i]->id == id)) in i40e_find_vsi_from_id()
296 return pf->vsi[i]; in i40e_find_vsi_from_id()
307 void i40e_service_event_schedule(struct i40e_pf *pf) in i40e_service_event_schedule() argument
309 if ((!test_bit(__I40E_DOWN, pf->state) && in i40e_service_event_schedule()
310 !test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) || in i40e_service_event_schedule()
311 test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_service_event_schedule()
312 queue_work(i40e_wq, &pf->service_task); in i40e_service_event_schedule()
328 struct i40e_pf *pf = vsi->back; in i40e_tx_timeout() local
333 pf->tx_timeout_count++; in i40e_tx_timeout()
346 if (time_after(jiffies, (pf->tx_timeout_last_recovery + HZ*20))) in i40e_tx_timeout()
347 pf->tx_timeout_recovery_level = 1; /* reset after some time */ in i40e_tx_timeout()
349 (pf->tx_timeout_last_recovery + netdev->watchdog_timeo))) in i40e_tx_timeout()
353 if (test_and_set_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state)) in i40e_tx_timeout()
359 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_tx_timeout()
360 val = rd32(&pf->hw, in i40e_tx_timeout()
364 val = rd32(&pf->hw, I40E_PFINT_DYN_CTL0); in i40e_tx_timeout()
372 pf->tx_timeout_last_recovery = jiffies; in i40e_tx_timeout()
374 pf->tx_timeout_recovery_level, txqueue); in i40e_tx_timeout()
376 switch (pf->tx_timeout_recovery_level) { in i40e_tx_timeout()
378 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_tx_timeout()
381 set_bit(__I40E_CORE_RESET_REQUESTED, pf->state); in i40e_tx_timeout()
384 set_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state); in i40e_tx_timeout()
388 set_bit(__I40E_DOWN_REQUESTED, pf->state); in i40e_tx_timeout()
393 i40e_service_event_schedule(pf); in i40e_tx_timeout()
394 pf->tx_timeout_recovery_level++; in i40e_tx_timeout()
531 void i40e_pf_reset_stats(struct i40e_pf *pf) in i40e_pf_reset_stats() argument
535 memset(&pf->stats, 0, sizeof(pf->stats)); in i40e_pf_reset_stats()
536 memset(&pf->stats_offsets, 0, sizeof(pf->stats_offsets)); in i40e_pf_reset_stats()
537 pf->stat_offsets_loaded = false; in i40e_pf_reset_stats()
540 if (pf->veb[i]) { in i40e_pf_reset_stats()
541 memset(&pf->veb[i]->stats, 0, in i40e_pf_reset_stats()
542 sizeof(pf->veb[i]->stats)); in i40e_pf_reset_stats()
543 memset(&pf->veb[i]->stats_offsets, 0, in i40e_pf_reset_stats()
544 sizeof(pf->veb[i]->stats_offsets)); in i40e_pf_reset_stats()
545 memset(&pf->veb[i]->tc_stats, 0, in i40e_pf_reset_stats()
546 sizeof(pf->veb[i]->tc_stats)); in i40e_pf_reset_stats()
547 memset(&pf->veb[i]->tc_stats_offsets, 0, in i40e_pf_reset_stats()
548 sizeof(pf->veb[i]->tc_stats_offsets)); in i40e_pf_reset_stats()
549 pf->veb[i]->stat_offsets_loaded = false; in i40e_pf_reset_stats()
552 pf->hw_csum_rx_error = 0; in i40e_pf_reset_stats()
702 struct i40e_pf *pf = vsi->back; in i40e_update_eth_stats() local
703 struct i40e_hw *hw = &pf->hw; in i40e_update_eth_stats()
767 struct i40e_pf *pf = veb->pf; in i40e_update_veb_stats() local
768 struct i40e_hw *hw = &pf->hw; in i40e_update_veb_stats()
853 struct i40e_pf *pf = vsi->back; in i40e_update_vsi_stats() local
870 test_bit(__I40E_CONFIG_BUSY, pf->state)) in i40e_update_vsi_stats()
979 if (vsi == pf->vsi[pf->lan_vsi]) { in i40e_update_vsi_stats()
980 ns->rx_crc_errors = pf->stats.crc_errors; in i40e_update_vsi_stats()
981 ns->rx_errors = pf->stats.crc_errors + pf->stats.illegal_bytes; in i40e_update_vsi_stats()
982 ns->rx_length_errors = pf->stats.rx_length_errors; in i40e_update_vsi_stats()
990 static void i40e_update_pf_stats(struct i40e_pf *pf) in i40e_update_pf_stats() argument
992 struct i40e_hw_port_stats *osd = &pf->stats_offsets; in i40e_update_pf_stats()
993 struct i40e_hw_port_stats *nsd = &pf->stats; in i40e_update_pf_stats()
994 struct i40e_hw *hw = &pf->hw; in i40e_update_pf_stats()
1000 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1004 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1007 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1012 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1017 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1022 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1027 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1032 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1037 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1042 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1047 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1051 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1055 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1059 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1064 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1069 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1072 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1075 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1078 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1083 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1087 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1091 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1095 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1100 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1107 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1111 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1115 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1119 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1123 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1127 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1131 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1136 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1140 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1144 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1148 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1152 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1156 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1160 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1164 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1167 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1170 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1173 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1195 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1198 pf->stat_offsets_loaded, in i40e_update_pf_stats()
1201 if (pf->flags & I40E_FLAG_FD_SB_ENABLED && in i40e_update_pf_stats()
1202 !test_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state)) in i40e_update_pf_stats()
1207 if (pf->flags & I40E_FLAG_FD_ATR_ENABLED && in i40e_update_pf_stats()
1208 !test_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state)) in i40e_update_pf_stats()
1213 pf->stat_offsets_loaded = true; in i40e_update_pf_stats()
1224 struct i40e_pf *pf = vsi->back; in i40e_update_stats() local
1226 if (vsi == pf->vsi[pf->lan_vsi]) in i40e_update_stats()
1227 i40e_update_pf_stats(pf); in i40e_update_stats()
1457 struct i40e_pf *pf = vsi->back; in i40e_rm_default_mac_filter() local
1468 i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL); in i40e_rm_default_mac_filter()
1476 i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL); in i40e_rm_default_mac_filter()
1675 struct i40e_pf *pf = vsi->back; in i40e_set_mac() local
1676 struct i40e_hw *hw = &pf->hw; in i40e_set_mac()
1688 if (test_bit(__I40E_DOWN, pf->state) || in i40e_set_mac()
1689 test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_set_mac()
1724 i40e_service_event_schedule(pf); in i40e_set_mac()
1738 struct i40e_pf *pf = vsi->back; in i40e_config_rss_aq() local
1739 struct i40e_hw *hw = &pf->hw; in i40e_config_rss_aq()
1747 dev_info(&pf->pdev->dev, in i40e_config_rss_aq()
1759 dev_info(&pf->pdev->dev, in i40e_config_rss_aq()
1775 struct i40e_pf *pf = vsi->back; in i40e_vsi_config_rss() local
1780 if (!(pf->hw_features & I40E_HW_RSS_AQ_CAPABLE)) in i40e_vsi_config_rss()
1783 vsi->rss_size = min_t(int, pf->alloc_rss_size, in i40e_vsi_config_rss()
1797 i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size); in i40e_vsi_config_rss()
1908 struct i40e_pf *pf = vsi->back; in i40e_vsi_setup_queue_map() local
1935 else if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_vsi_setup_queue_map()
1936 vsi->num_queue_pairs = pf->num_lan_msix; in i40e_vsi_setup_queue_map()
1955 dev_warn(&pf->pdev->dev, "DCB is enabled but no TC enabled, forcing TC0\n"); in i40e_vsi_setup_queue_map()
1960 i40e_pf_get_max_q_per_tc(pf)); in i40e_vsi_setup_queue_map()
1967 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_vsi_setup_queue_map()
1968 num_tc_qps = min_t(int, num_tc_qps, pf->num_lan_msix); in i40e_vsi_setup_queue_map()
1979 if (!(pf->flags & (I40E_FLAG_FD_SB_ENABLED | in i40e_vsi_setup_queue_map()
1982 qcount = min_t(int, pf->alloc_rss_size, in i40e_vsi_setup_queue_map()
2358 static int i40e_set_promiscuous(struct i40e_pf *pf, bool promisc) in i40e_set_promiscuous() argument
2360 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_set_promiscuous()
2361 struct i40e_hw *hw = &pf->hw; in i40e_set_promiscuous()
2365 pf->lan_veb != I40E_NO_VEB && in i40e_set_promiscuous()
2366 !(pf->flags & I40E_FLAG_MFP_ENABLED)) { in i40e_set_promiscuous()
2381 dev_info(&pf->pdev->dev, in i40e_set_promiscuous()
2393 dev_info(&pf->pdev->dev, in i40e_set_promiscuous()
2403 dev_info(&pf->pdev->dev, in i40e_set_promiscuous()
2411 pf->cur_promisc = promisc; in i40e_set_promiscuous()
2438 struct i40e_pf *pf; in i40e_sync_vsi_filters() local
2452 pf = vsi->back; in i40e_sync_vsi_filters()
2670 dev_info(&pf->pdev->dev, in i40e_sync_vsi_filters()
2678 if ((vsi->type == I40E_VSI_SRIOV) && !pf->vf[vsi->vf_id].trusted) { in i40e_sync_vsi_filters()
2703 dev_info(&pf->pdev->dev, in i40e_sync_vsi_filters()
2709 dev_info(&pf->pdev->dev, "%s allmulti mode.\n", in i40e_sync_vsi_filters()
2719 aq_ret = i40e_set_promiscuous(pf, cur_promisc); in i40e_sync_vsi_filters()
2723 dev_info(&pf->pdev->dev, in i40e_sync_vsi_filters()
2756 static void i40e_sync_filters_subtask(struct i40e_pf *pf) in i40e_sync_filters_subtask() argument
2760 if (!pf) in i40e_sync_filters_subtask()
2762 if (!test_and_clear_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state)) in i40e_sync_filters_subtask()
2764 if (test_bit(__I40E_VF_DISABLE, pf->state)) { in i40e_sync_filters_subtask()
2765 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_sync_filters_subtask()
2769 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_sync_filters_subtask()
2770 if (pf->vsi[v] && in i40e_sync_filters_subtask()
2771 (pf->vsi[v]->flags & I40E_VSI_FLAG_FILTER_CHANGED) && in i40e_sync_filters_subtask()
2772 !test_bit(__I40E_VSI_RELEASING, pf->vsi[v]->state)) { in i40e_sync_filters_subtask()
2773 int ret = i40e_sync_vsi_filters(pf->vsi[v]); in i40e_sync_filters_subtask()
2778 pf->state); in i40e_sync_filters_subtask()
2808 struct i40e_pf *pf = vsi->back; in i40e_change_mtu() local
2822 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_change_mtu()
2823 set_bit(__I40E_CLIENT_L2_CHANGE, pf->state); in i40e_change_mtu()
2836 struct i40e_pf *pf = np->vsi->back; in i40e_ioctl() local
2840 return i40e_ptp_get_ts_config(pf, ifr); in i40e_ioctl()
2842 return i40e_ptp_set_ts_config(pf, ifr); in i40e_ioctl()
3662 static void i40e_reset_fdir_filter_cnt(struct i40e_pf *pf) in i40e_reset_fdir_filter_cnt() argument
3664 pf->fd_tcp4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3665 pf->fd_udp4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3666 pf->fd_sctp4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3667 pf->fd_ip4_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3668 pf->fd_tcp6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3669 pf->fd_udp6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3670 pf->fd_sctp6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3671 pf->fd_ip6_filter_cnt = 0; in i40e_reset_fdir_filter_cnt()
3684 struct i40e_pf *pf = vsi->back; in i40e_fdir_filter_restore() local
3687 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) in i40e_fdir_filter_restore()
3691 i40e_reset_fdir_filter_cnt(pf); in i40e_fdir_filter_restore()
3694 &pf->fdir_filter_list, fdir_node) { in i40e_fdir_filter_restore()
3724 struct i40e_pf *pf = vsi->back; in i40e_vsi_configure_msix() local
3725 struct i40e_hw *hw = &pf->hw; in i40e_vsi_configure_msix()
3806 static void i40e_enable_misc_int_causes(struct i40e_pf *pf) in i40e_enable_misc_int_causes() argument
3808 struct i40e_hw *hw = &pf->hw; in i40e_enable_misc_int_causes()
3824 if (pf->flags & I40E_FLAG_IWARP_ENABLED) in i40e_enable_misc_int_causes()
3827 if (pf->flags & I40E_FLAG_PTP) in i40e_enable_misc_int_causes()
3848 struct i40e_pf *pf = vsi->back; in i40e_configure_msi_and_legacy() local
3849 struct i40e_hw *hw = &pf->hw; in i40e_configure_msi_and_legacy()
3862 i40e_enable_misc_int_causes(pf); in i40e_configure_msi_and_legacy()
3896 void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf) in i40e_irq_dynamic_disable_icr0() argument
3898 struct i40e_hw *hw = &pf->hw; in i40e_irq_dynamic_disable_icr0()
3909 void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf) in i40e_irq_dynamic_enable_icr0() argument
3911 struct i40e_hw *hw = &pf->hw; in i40e_irq_dynamic_enable_icr0()
3976 struct i40e_pf *pf = vsi->back; in i40e_vsi_request_irq_msix() local
3987 irq_num = pf->msix_entries[base + vector].vector; in i40e_vsi_request_irq_msix()
4009 dev_info(&pf->pdev->dev, in i40e_vsi_request_irq_msix()
4034 irq_num = pf->msix_entries[base + vector].vector; in i40e_vsi_request_irq_msix()
4048 struct i40e_pf *pf = vsi->back; in i40e_vsi_disable_irq() local
4049 struct i40e_hw *hw = &pf->hw; in i40e_vsi_disable_irq()
4071 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_vsi_disable_irq()
4078 synchronize_irq(pf->msix_entries[i + base].vector); in i40e_vsi_disable_irq()
4084 synchronize_irq(pf->pdev->irq); in i40e_vsi_disable_irq()
4094 struct i40e_pf *pf = vsi->back; in i40e_vsi_enable_irq() local
4097 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_vsi_enable_irq()
4101 i40e_irq_dynamic_enable_icr0(pf); in i40e_vsi_enable_irq()
4104 i40e_flush(&pf->hw); in i40e_vsi_enable_irq()
4112 static void i40e_free_misc_vector(struct i40e_pf *pf) in i40e_free_misc_vector() argument
4115 wr32(&pf->hw, I40E_PFINT_ICR0_ENA, 0); in i40e_free_misc_vector()
4116 i40e_flush(&pf->hw); in i40e_free_misc_vector()
4118 if (pf->flags & I40E_FLAG_MSIX_ENABLED && pf->msix_entries) { in i40e_free_misc_vector()
4119 synchronize_irq(pf->msix_entries[0].vector); in i40e_free_misc_vector()
4120 free_irq(pf->msix_entries[0].vector, pf); in i40e_free_misc_vector()
4121 clear_bit(__I40E_MISC_IRQ_REQUESTED, pf->state); in i40e_free_misc_vector()
4136 struct i40e_pf *pf = (struct i40e_pf *)data; in i40e_intr() local
4137 struct i40e_hw *hw = &pf->hw; in i40e_intr()
4152 pf->sw_int_count++; in i40e_intr()
4154 if ((pf->flags & I40E_FLAG_IWARP_ENABLED) && in i40e_intr()
4157 dev_dbg(&pf->pdev->dev, "cleared PE_CRITERR\n"); in i40e_intr()
4158 set_bit(__I40E_CORE_RESET_REQUESTED, pf->state); in i40e_intr()
4163 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_intr()
4172 if (!test_bit(__I40E_DOWN, pf->state)) in i40e_intr()
4178 set_bit(__I40E_ADMINQ_EVENT_PENDING, pf->state); in i40e_intr()
4179 i40e_debug(&pf->hw, I40E_DEBUG_NVM, "AdminQ event\n"); in i40e_intr()
4184 set_bit(__I40E_MDD_EVENT_PENDING, pf->state); in i40e_intr()
4189 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) { in i40e_intr()
4196 set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_intr()
4201 if (!test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_intr()
4202 set_bit(__I40E_RESET_INTR_RECEIVED, pf->state); in i40e_intr()
4208 pf->corer_count++; in i40e_intr()
4210 pf->globr_count++; in i40e_intr()
4212 pf->empr_count++; in i40e_intr()
4213 set_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state); in i40e_intr()
4219 dev_info(&pf->pdev->dev, "HMC error interrupt\n"); in i40e_intr()
4220 dev_info(&pf->pdev->dev, "HMC error info 0x%x, HMC error data 0x%x\n", in i40e_intr()
4229 schedule_work(&pf->ptp_extts0_work); in i40e_intr()
4232 i40e_ptp_tx_hwtstamp(pf); in i40e_intr()
4243 dev_info(&pf->pdev->dev, "unhandled interrupt icr0=0x%08x\n", in i40e_intr()
4248 dev_info(&pf->pdev->dev, "device will be reset\n"); in i40e_intr()
4249 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_intr()
4250 i40e_service_event_schedule(pf); in i40e_intr()
4259 if (!test_bit(__I40E_DOWN, pf->state) || in i40e_intr()
4260 test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_intr()
4261 i40e_service_event_schedule(pf); in i40e_intr()
4262 i40e_irq_dynamic_enable_icr0(pf); in i40e_intr()
4457 struct i40e_pf *pf = vsi->back; in i40e_vsi_request_irq() local
4460 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_vsi_request_irq()
4462 else if (pf->flags & I40E_FLAG_MSI_ENABLED) in i40e_vsi_request_irq()
4463 err = request_irq(pf->pdev->irq, i40e_intr, 0, in i40e_vsi_request_irq()
4464 pf->int_name, pf); in i40e_vsi_request_irq()
4466 err = request_irq(pf->pdev->irq, i40e_intr, IRQF_SHARED, in i40e_vsi_request_irq()
4467 pf->int_name, pf); in i40e_vsi_request_irq()
4470 dev_info(&pf->pdev->dev, "request_irq failed, Error %d\n", err); in i40e_vsi_request_irq()
4487 struct i40e_pf *pf = vsi->back; in i40e_netpoll() local
4494 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_netpoll()
4498 i40e_intr(pf->pdev->irq, netdev); in i40e_netpoll()
4516 static int i40e_pf_txq_wait(struct i40e_pf *pf, int pf_q, bool enable) in i40e_pf_txq_wait() argument
4522 tx_reg = rd32(&pf->hw, I40E_QTX_ENA(pf_q)); in i40e_pf_txq_wait()
4544 static void i40e_control_tx_q(struct i40e_pf *pf, int pf_q, bool enable) in i40e_control_tx_q() argument
4546 struct i40e_hw *hw = &pf->hw; in i40e_control_tx_q()
4551 i40e_pre_tx_queue_cfg(&pf->hw, pf_q, enable); in i40e_control_tx_q()
4586 int i40e_control_wait_tx_q(int seid, struct i40e_pf *pf, int pf_q, in i40e_control_wait_tx_q() argument
4591 i40e_control_tx_q(pf, pf_q, enable); in i40e_control_wait_tx_q()
4594 ret = i40e_pf_txq_wait(pf, pf_q, enable); in i40e_control_wait_tx_q()
4596 dev_info(&pf->pdev->dev, in i40e_control_wait_tx_q()
4611 struct i40e_pf *pf = vsi->back; in i40e_vsi_enable_tx() local
4616 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_vsi_enable_tx()
4625 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_vsi_enable_tx()
4645 static int i40e_pf_rxq_wait(struct i40e_pf *pf, int pf_q, bool enable) in i40e_pf_rxq_wait() argument
4651 rx_reg = rd32(&pf->hw, I40E_QRX_ENA(pf_q)); in i40e_pf_rxq_wait()
4673 static void i40e_control_rx_q(struct i40e_pf *pf, int pf_q, bool enable) in i40e_control_rx_q() argument
4675 struct i40e_hw *hw = &pf->hw; in i40e_control_rx_q()
4710 int i40e_control_wait_rx_q(struct i40e_pf *pf, int pf_q, bool enable) in i40e_control_wait_rx_q() argument
4714 i40e_control_rx_q(pf, pf_q, enable); in i40e_control_wait_rx_q()
4717 ret = i40e_pf_rxq_wait(pf, pf_q, enable); in i40e_control_wait_rx_q()
4730 struct i40e_pf *pf = vsi->back; in i40e_vsi_enable_rx() local
4735 ret = i40e_control_wait_rx_q(pf, pf_q, true); in i40e_vsi_enable_rx()
4737 dev_info(&pf->pdev->dev, in i40e_vsi_enable_rx()
4772 struct i40e_pf *pf = vsi->back; in i40e_vsi_stop_rings() local
4781 i40e_pre_tx_queue_cfg(&pf->hw, (u32)pf_q, false); in i40e_vsi_stop_rings()
4784 err = i40e_control_wait_rx_q(pf, pf_q, false); in i40e_vsi_stop_rings()
4786 dev_info(&pf->pdev->dev, in i40e_vsi_stop_rings()
4794 wr32(&pf->hw, I40E_QTX_ENA(pf_q), 0); in i40e_vsi_stop_rings()
4812 struct i40e_pf *pf = vsi->back; in i40e_vsi_stop_rings_no_wait() local
4817 i40e_control_tx_q(pf, pf_q, false); in i40e_vsi_stop_rings_no_wait()
4818 i40e_control_rx_q(pf, pf_q, false); in i40e_vsi_stop_rings_no_wait()
4828 struct i40e_pf *pf = vsi->back; in i40e_vsi_free_irq() local
4829 struct i40e_hw *hw = &pf->hw; in i40e_vsi_free_irq()
4834 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_vsi_free_irq()
4847 irq_num = pf->msix_entries[vector].vector; in i40e_vsi_free_irq()
4908 free_irq(pf->pdev->irq, pf); in i40e_vsi_free_irq()
4994 static void i40e_reset_interrupt_capability(struct i40e_pf *pf) in i40e_reset_interrupt_capability() argument
4997 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_reset_interrupt_capability()
4998 pci_disable_msix(pf->pdev); in i40e_reset_interrupt_capability()
4999 kfree(pf->msix_entries); in i40e_reset_interrupt_capability()
5000 pf->msix_entries = NULL; in i40e_reset_interrupt_capability()
5001 kfree(pf->irq_pile); in i40e_reset_interrupt_capability()
5002 pf->irq_pile = NULL; in i40e_reset_interrupt_capability()
5003 } else if (pf->flags & I40E_FLAG_MSI_ENABLED) { in i40e_reset_interrupt_capability()
5004 pci_disable_msi(pf->pdev); in i40e_reset_interrupt_capability()
5006 pf->flags &= ~(I40E_FLAG_MSIX_ENABLED | I40E_FLAG_MSI_ENABLED); in i40e_reset_interrupt_capability()
5016 static void i40e_clear_interrupt_scheme(struct i40e_pf *pf) in i40e_clear_interrupt_scheme() argument
5020 if (test_bit(__I40E_MISC_IRQ_REQUESTED, pf->state)) in i40e_clear_interrupt_scheme()
5021 i40e_free_misc_vector(pf); in i40e_clear_interrupt_scheme()
5023 i40e_put_lump(pf->irq_pile, pf->iwarp_base_vector, in i40e_clear_interrupt_scheme()
5026 i40e_put_lump(pf->irq_pile, 0, I40E_PILE_VALID_BIT-1); in i40e_clear_interrupt_scheme()
5027 for (i = 0; i < pf->num_alloc_vsi; i++) in i40e_clear_interrupt_scheme()
5028 if (pf->vsi[i]) in i40e_clear_interrupt_scheme()
5029 i40e_vsi_free_q_vectors(pf->vsi[i]); in i40e_clear_interrupt_scheme()
5030 i40e_reset_interrupt_capability(pf); in i40e_clear_interrupt_scheme()
5077 struct i40e_pf *pf = vsi->back; in i40e_vsi_close() local
5084 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_vsi_close()
5085 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_vsi_close()
5086 set_bit(__I40E_CLIENT_RESET, pf->state); in i40e_vsi_close()
5124 static void i40e_pf_quiesce_all_vsi(struct i40e_pf *pf) in i40e_pf_quiesce_all_vsi() argument
5128 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_pf_quiesce_all_vsi()
5129 if (pf->vsi[v]) in i40e_pf_quiesce_all_vsi()
5130 i40e_quiesce_vsi(pf->vsi[v]); in i40e_pf_quiesce_all_vsi()
5138 static void i40e_pf_unquiesce_all_vsi(struct i40e_pf *pf) in i40e_pf_unquiesce_all_vsi() argument
5142 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_pf_unquiesce_all_vsi()
5143 if (pf->vsi[v]) in i40e_pf_unquiesce_all_vsi()
5144 i40e_unquiesce_vsi(pf->vsi[v]); in i40e_pf_unquiesce_all_vsi()
5156 struct i40e_pf *pf = vsi->back; in i40e_vsi_wait_queues_disabled() local
5162 ret = i40e_pf_txq_wait(pf, pf_q, false); in i40e_vsi_wait_queues_disabled()
5164 dev_info(&pf->pdev->dev, in i40e_vsi_wait_queues_disabled()
5174 ret = i40e_pf_txq_wait(pf, pf_q + vsi->alloc_queue_pairs, in i40e_vsi_wait_queues_disabled()
5177 dev_info(&pf->pdev->dev, in i40e_vsi_wait_queues_disabled()
5184 ret = i40e_pf_rxq_wait(pf, pf_q, false); in i40e_vsi_wait_queues_disabled()
5186 dev_info(&pf->pdev->dev, in i40e_vsi_wait_queues_disabled()
5204 static int i40e_pf_wait_queues_disabled(struct i40e_pf *pf) in i40e_pf_wait_queues_disabled() argument
5208 for (v = 0; v < pf->hw.func_caps.num_vsis; v++) { in i40e_pf_wait_queues_disabled()
5209 if (pf->vsi[v]) { in i40e_pf_wait_queues_disabled()
5210 ret = i40e_vsi_wait_queues_disabled(pf->vsi[v]); in i40e_pf_wait_queues_disabled()
5228 static u8 i40e_get_iscsi_tc_map(struct i40e_pf *pf) in i40e_get_iscsi_tc_map() argument
5231 struct i40e_hw *hw = &pf->hw; in i40e_get_iscsi_tc_map()
5318 static u8 i40e_mqprio_get_enabled_tc(struct i40e_pf *pf) in i40e_mqprio_get_enabled_tc() argument
5320 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_mqprio_get_enabled_tc()
5335 static u8 i40e_pf_get_num_tc(struct i40e_pf *pf) in i40e_pf_get_num_tc() argument
5337 struct i40e_hw *hw = &pf->hw; in i40e_pf_get_num_tc()
5342 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_pf_get_num_tc()
5343 return pf->vsi[pf->lan_vsi]->mqprio_qopt.qopt.num_tc; in i40e_pf_get_num_tc()
5346 if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) in i40e_pf_get_num_tc()
5350 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) in i40e_pf_get_num_tc()
5354 if (pf->hw.func_caps.iscsi) in i40e_pf_get_num_tc()
5355 enabled_tc = i40e_get_iscsi_tc_map(pf); in i40e_pf_get_num_tc()
5372 static u8 i40e_pf_get_tc_map(struct i40e_pf *pf) in i40e_pf_get_tc_map() argument
5374 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_pf_get_tc_map()
5375 return i40e_mqprio_get_enabled_tc(pf); in i40e_pf_get_tc_map()
5380 if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) in i40e_pf_get_tc_map()
5384 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) in i40e_pf_get_tc_map()
5385 return i40e_dcb_get_enabled_tc(&pf->hw.local_dcbx_config); in i40e_pf_get_tc_map()
5388 if (pf->hw.func_caps.iscsi) in i40e_pf_get_tc_map()
5389 return i40e_get_iscsi_tc_map(pf); in i40e_pf_get_tc_map()
5404 struct i40e_pf *pf = vsi->back; in i40e_vsi_get_bw_info() local
5405 struct i40e_hw *hw = &pf->hw; in i40e_vsi_get_bw_info()
5413 dev_info(&pf->pdev->dev, in i40e_vsi_get_bw_info()
5415 i40e_stat_str(&pf->hw, ret), in i40e_vsi_get_bw_info()
5416 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vsi_get_bw_info()
5424 dev_info(&pf->pdev->dev, in i40e_vsi_get_bw_info()
5426 i40e_stat_str(&pf->hw, ret), in i40e_vsi_get_bw_info()
5427 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vsi_get_bw_info()
5432 dev_info(&pf->pdev->dev, in i40e_vsi_get_bw_info()
5466 struct i40e_pf *pf = vsi->back; in i40e_vsi_configure_bw_alloc() local
5471 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_vsi_configure_bw_alloc()
5473 if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) { in i40e_vsi_configure_bw_alloc()
5476 dev_info(&pf->pdev->dev, in i40e_vsi_configure_bw_alloc()
5486 ret = i40e_aq_config_vsi_tc_bw(&pf->hw, vsi->seid, &bw_data, NULL); in i40e_vsi_configure_bw_alloc()
5488 dev_info(&pf->pdev->dev, in i40e_vsi_configure_bw_alloc()
5490 pf->hw.aq.asq_last_status); in i40e_vsi_configure_bw_alloc()
5509 struct i40e_pf *pf = vsi->back; in i40e_vsi_config_netdev_tc() local
5510 struct i40e_hw *hw = &pf->hw; in i40e_vsi_config_netdev_tc()
5543 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_vsi_config_netdev_tc()
5583 struct i40e_pf *pf; in i40e_update_adq_vsi_queues() local
5589 pf = vsi->back; in i40e_update_adq_vsi_queues()
5590 hw = &pf->hw; in i40e_update_adq_vsi_queues()
5603 vsi->rss_size = min_t(int, pf->alloc_rss_size, in i40e_update_adq_vsi_queues()
5607 dev_info(&pf->pdev->dev, "Failed to reconfig rss for num_queues\n"); in i40e_update_adq_vsi_queues()
5615 dev_info(&pf->pdev->dev, "Update vsi config failed, err %s aq_err %s\n", in i40e_update_adq_vsi_queues()
5643 struct i40e_pf *pf = vsi->back; in i40e_vsi_config_tc() local
5644 struct i40e_hw *hw = &pf->hw; in i40e_vsi_config_tc()
5664 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5670 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5683 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5691 dev_err(&pf->pdev->dev, in i40e_vsi_config_tc()
5704 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_vsi_config_tc()
5737 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5750 dev_info(&pf->pdev->dev, in i40e_vsi_config_tc()
5770 struct i40e_pf *pf = vsi->back; in i40e_get_link_speed() local
5772 switch (pf->hw.phy.link_info.link_speed) { in i40e_get_link_speed()
5798 struct i40e_pf *pf = vsi->back; in i40e_set_bw_limit() local
5805 dev_err(&pf->pdev->dev, in i40e_set_bw_limit()
5811 dev_warn(&pf->pdev->dev, in i40e_set_bw_limit()
5819 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, seid, credits, in i40e_set_bw_limit()
5822 dev_err(&pf->pdev->dev, in i40e_set_bw_limit()
5824 max_tx_rate, seid, i40e_stat_str(&pf->hw, ret), in i40e_set_bw_limit()
5825 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_set_bw_limit()
5840 struct i40e_pf *pf = vsi->back; in i40e_remove_queue_channels() local
5884 &pf->cloud_filter_list, cloud_node) { in i40e_remove_queue_channels()
5896 last_aq_status = pf->hw.aq.asq_last_status; in i40e_remove_queue_channels()
5898 dev_info(&pf->pdev->dev, in i40e_remove_queue_channels()
5900 i40e_stat_str(&pf->hw, ret), in i40e_remove_queue_channels()
5901 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_remove_queue_channels()
5950 static int i40e_validate_num_queues(struct i40e_pf *pf, int num_queues, in i40e_validate_num_queues() argument
5961 dev_dbg(&pf->pdev->dev, in i40e_validate_num_queues()
5967 dev_dbg(&pf->pdev->dev, in i40e_validate_num_queues()
5982 dev_dbg(&pf->pdev->dev, in i40e_validate_num_queues()
6002 struct i40e_pf *pf = vsi->back; in i40e_vsi_reconfig_rss() local
6004 struct i40e_hw *hw = &pf->hw; in i40e_vsi_reconfig_rss()
6021 i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, local_rss_size); in i40e_vsi_reconfig_rss()
6033 dev_info(&pf->pdev->dev, in i40e_vsi_reconfig_rss()
6058 static void i40e_channel_setup_queue_map(struct i40e_pf *pf, in i40e_channel_setup_queue_map() argument
6069 qcount = min_t(int, ch->num_queue_pairs, pf->num_lan_msix); in i40e_channel_setup_queue_map()
6097 static int i40e_add_channel(struct i40e_pf *pf, u16 uplink_seid, in i40e_add_channel() argument
6100 struct i40e_hw *hw = &pf->hw; in i40e_add_channel()
6106 dev_info(&pf->pdev->dev, in i40e_add_channel()
6119 if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED) { in i40e_add_channel()
6127 i40e_channel_setup_queue_map(pf, &ctxt, ch); in i40e_add_channel()
6132 dev_info(&pf->pdev->dev, in i40e_add_channel()
6134 i40e_stat_str(&pf->hw, ret), in i40e_add_channel()
6135 i40e_aq_str(&pf->hw, in i40e_add_channel()
6136 pf->hw.aq.asq_last_status)); in i40e_add_channel()
6197 static int i40e_channel_config_tx_ring(struct i40e_pf *pf, in i40e_channel_config_tx_ring() argument
6251 static inline int i40e_setup_hw_channel(struct i40e_pf *pf, in i40e_setup_hw_channel() argument
6263 ret = i40e_add_channel(pf, uplink_seid, ch); in i40e_setup_hw_channel()
6265 dev_info(&pf->pdev->dev, in i40e_setup_hw_channel()
6275 ret = i40e_channel_config_tx_ring(pf, vsi, ch); in i40e_setup_hw_channel()
6277 dev_info(&pf->pdev->dev, in i40e_setup_hw_channel()
6285 dev_dbg(&pf->pdev->dev, in i40e_setup_hw_channel()
6302 static bool i40e_setup_channel(struct i40e_pf *pf, struct i40e_vsi *vsi, in i40e_setup_channel() argument
6312 dev_err(&pf->pdev->dev, "unsupported parent vsi type(%d)\n", in i40e_setup_channel()
6318 seid = pf->vsi[pf->lan_vsi]->uplink_seid; in i40e_setup_channel()
6321 ret = i40e_setup_hw_channel(pf, vsi, ch, seid, vsi_type); in i40e_setup_channel()
6323 dev_err(&pf->pdev->dev, "failed to setup hw_channel\n"); in i40e_setup_channel()
6340 struct i40e_pf *pf = vsi->back; in i40e_validate_and_set_switch_mode() local
6341 struct i40e_hw *hw = &pf->hw; in i40e_validate_and_set_switch_mode()
6344 ret = i40e_get_capabilities(pf, i40e_aqc_opc_list_dev_capabilities); in i40e_validate_and_set_switch_mode()
6357 dev_err(&pf->pdev->dev, in i40e_validate_and_set_switch_mode()
6374 ret = i40e_aq_set_switch_config(hw, pf->last_sw_conf_flags, in i40e_validate_and_set_switch_mode()
6375 pf->last_sw_conf_valid_flags, in i40e_validate_and_set_switch_mode()
6378 dev_err(&pf->pdev->dev, in i40e_validate_and_set_switch_mode()
6398 struct i40e_pf *pf = vsi->back; in i40e_create_queue_channel() local
6406 dev_err(&pf->pdev->dev, "Invalid num_queues requested: %d\n", in i40e_create_queue_channel()
6412 err = i40e_validate_num_queues(pf, ch->num_queue_pairs, vsi, in i40e_create_queue_channel()
6415 dev_info(&pf->pdev->dev, "Failed to validate num_queues (%d)\n", in i40e_create_queue_channel()
6424 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_create_queue_channel()
6425 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_create_queue_channel()
6428 if (i40e_is_tc_mqprio_enabled(pf)) in i40e_create_queue_channel()
6429 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_create_queue_channel()
6431 i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG); in i40e_create_queue_channel()
6442 dev_dbg(&pf->pdev->dev, in i40e_create_queue_channel()
6452 dev_info(&pf->pdev->dev, in i40e_create_queue_channel()
6459 if (!i40e_setup_channel(pf, vsi, ch)) { in i40e_create_queue_channel()
6460 dev_info(&pf->pdev->dev, "Failed to setup channel\n"); in i40e_create_queue_channel()
6464 dev_info(&pf->pdev->dev, in i40e_create_queue_channel()
6476 dev_dbg(&pf->pdev->dev, in i40e_create_queue_channel()
6559 struct i40e_pf *pf = veb->pf; in i40e_veb_config_tc() local
6576 ret = i40e_aq_config_switch_comp_bw_config(&pf->hw, veb->seid, in i40e_veb_config_tc()
6579 dev_info(&pf->pdev->dev, in i40e_veb_config_tc()
6581 i40e_stat_str(&pf->hw, ret), in i40e_veb_config_tc()
6582 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_veb_config_tc()
6589 dev_info(&pf->pdev->dev, in i40e_veb_config_tc()
6591 i40e_stat_str(&pf->hw, ret), in i40e_veb_config_tc()
6592 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_veb_config_tc()
6608 static void i40e_dcb_reconfigure(struct i40e_pf *pf) in i40e_dcb_reconfigure() argument
6615 tc_map = i40e_pf_get_tc_map(pf); in i40e_dcb_reconfigure()
6620 if (!pf->veb[v]) in i40e_dcb_reconfigure()
6622 ret = i40e_veb_config_tc(pf->veb[v], tc_map); in i40e_dcb_reconfigure()
6624 dev_info(&pf->pdev->dev, in i40e_dcb_reconfigure()
6626 pf->veb[v]->seid); in i40e_dcb_reconfigure()
6632 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_dcb_reconfigure()
6633 if (!pf->vsi[v]) in i40e_dcb_reconfigure()
6639 if (v == pf->lan_vsi) in i40e_dcb_reconfigure()
6640 tc_map = i40e_pf_get_tc_map(pf); in i40e_dcb_reconfigure()
6644 ret = i40e_vsi_config_tc(pf->vsi[v], tc_map); in i40e_dcb_reconfigure()
6646 dev_info(&pf->pdev->dev, in i40e_dcb_reconfigure()
6648 pf->vsi[v]->seid); in i40e_dcb_reconfigure()
6652 i40e_vsi_map_rings_to_vectors(pf->vsi[v]); in i40e_dcb_reconfigure()
6653 if (pf->vsi[v]->netdev) in i40e_dcb_reconfigure()
6654 i40e_dcbnl_set_all(pf->vsi[v]); in i40e_dcb_reconfigure()
6666 static int i40e_resume_port_tx(struct i40e_pf *pf) in i40e_resume_port_tx() argument
6668 struct i40e_hw *hw = &pf->hw; in i40e_resume_port_tx()
6673 dev_info(&pf->pdev->dev, in i40e_resume_port_tx()
6675 i40e_stat_str(&pf->hw, ret), in i40e_resume_port_tx()
6676 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_resume_port_tx()
6678 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_resume_port_tx()
6679 i40e_service_event_schedule(pf); in i40e_resume_port_tx()
6691 static int i40e_suspend_port_tx(struct i40e_pf *pf) in i40e_suspend_port_tx() argument
6693 struct i40e_hw *hw = &pf->hw; in i40e_suspend_port_tx()
6696 ret = i40e_aq_suspend_port_tx(hw, pf->mac_seid, NULL); in i40e_suspend_port_tx()
6698 dev_info(&pf->pdev->dev, in i40e_suspend_port_tx()
6700 i40e_stat_str(&pf->hw, ret), in i40e_suspend_port_tx()
6701 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_suspend_port_tx()
6703 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_suspend_port_tx()
6704 i40e_service_event_schedule(pf); in i40e_suspend_port_tx()
6718 static int i40e_hw_set_dcb_config(struct i40e_pf *pf, in i40e_hw_set_dcb_config() argument
6721 struct i40e_dcbx_config *old_cfg = &pf->hw.local_dcbx_config; in i40e_hw_set_dcb_config()
6726 dev_dbg(&pf->pdev->dev, "No Change in DCB Config required.\n"); in i40e_hw_set_dcb_config()
6731 i40e_pf_quiesce_all_vsi(pf); in i40e_hw_set_dcb_config()
6736 ret = i40e_set_dcb_config(&pf->hw); in i40e_hw_set_dcb_config()
6738 dev_info(&pf->pdev->dev, in i40e_hw_set_dcb_config()
6740 i40e_stat_str(&pf->hw, ret), in i40e_hw_set_dcb_config()
6741 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_hw_set_dcb_config()
6746 i40e_dcb_reconfigure(pf); in i40e_hw_set_dcb_config()
6749 if (!test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) { in i40e_hw_set_dcb_config()
6751 ret = i40e_resume_port_tx(pf); in i40e_hw_set_dcb_config()
6755 i40e_pf_unquiesce_all_vsi(pf); in i40e_hw_set_dcb_config()
6769 int i40e_hw_dcb_config(struct i40e_pf *pf, struct i40e_dcbx_config *new_cfg) in i40e_hw_dcb_config() argument
6777 struct i40e_hw *hw = &pf->hw; in i40e_hw_dcb_config()
6786 dev_dbg(&pf->pdev->dev, "Configuring DCB registers directly\n"); in i40e_hw_dcb_config()
6828 need_reconfig = i40e_dcb_need_reconfig(pf, old_cfg, new_cfg); in i40e_hw_dcb_config()
6836 pf->flags |= I40E_FLAG_DCB_ENABLED; in i40e_hw_dcb_config()
6838 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_hw_dcb_config()
6840 set_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_hw_dcb_config()
6842 i40e_pf_quiesce_all_vsi(pf); in i40e_hw_dcb_config()
6843 ret = i40e_suspend_port_tx(pf); in i40e_hw_dcb_config()
6852 (hw, pf->mac_seid, &ets_data, in i40e_hw_dcb_config()
6855 dev_info(&pf->pdev->dev, in i40e_hw_dcb_config()
6857 i40e_stat_str(&pf->hw, ret), in i40e_hw_dcb_config()
6858 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_hw_dcb_config()
6878 mfs_tc[i] = pf->vsi[pf->lan_vsi]->netdev->mtu; in i40e_hw_dcb_config()
6885 i40e_dcb_hw_rx_pb_config(hw, &pf->pb_cfg, &pb_cfg); in i40e_hw_dcb_config()
6888 pf->pb_cfg = pb_cfg; in i40e_hw_dcb_config()
6891 ret = i40e_aq_dcb_updated(&pf->hw, NULL); in i40e_hw_dcb_config()
6893 dev_info(&pf->pdev->dev, in i40e_hw_dcb_config()
6895 i40e_stat_str(&pf->hw, ret), in i40e_hw_dcb_config()
6896 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_hw_dcb_config()
6904 i40e_dcb_reconfigure(pf); in i40e_hw_dcb_config()
6908 ret = i40e_resume_port_tx(pf); in i40e_hw_dcb_config()
6910 clear_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_hw_dcb_config()
6916 ret = i40e_pf_wait_queues_disabled(pf); in i40e_hw_dcb_config()
6919 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_hw_dcb_config()
6920 i40e_service_event_schedule(pf); in i40e_hw_dcb_config()
6923 i40e_pf_unquiesce_all_vsi(pf); in i40e_hw_dcb_config()
6924 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_hw_dcb_config()
6925 set_bit(__I40E_CLIENT_L2_CHANGE, pf->state); in i40e_hw_dcb_config()
6928 if (pf->hw_features & I40E_HW_USE_SET_LLDP_MIB) in i40e_hw_dcb_config()
6929 ret = i40e_hw_set_dcb_config(pf, new_cfg); in i40e_hw_dcb_config()
6942 int i40e_dcb_sw_default_config(struct i40e_pf *pf) in i40e_dcb_sw_default_config() argument
6944 struct i40e_dcbx_config *dcb_cfg = &pf->hw.local_dcbx_config; in i40e_dcb_sw_default_config()
6946 struct i40e_hw *hw = &pf->hw; in i40e_dcb_sw_default_config()
6949 if (pf->hw_features & I40E_HW_USE_SET_LLDP_MIB) { in i40e_dcb_sw_default_config()
6951 memset(&pf->tmp_cfg, 0, sizeof(struct i40e_dcbx_config)); in i40e_dcb_sw_default_config()
6952 pf->tmp_cfg.etscfg.willing = I40E_IEEE_DEFAULT_ETS_WILLING; in i40e_dcb_sw_default_config()
6953 pf->tmp_cfg.etscfg.maxtcs = 0; in i40e_dcb_sw_default_config()
6954 pf->tmp_cfg.etscfg.tcbwtable[0] = I40E_IEEE_DEFAULT_ETS_TCBW; in i40e_dcb_sw_default_config()
6955 pf->tmp_cfg.etscfg.tsatable[0] = I40E_IEEE_TSA_ETS; in i40e_dcb_sw_default_config()
6956 pf->tmp_cfg.pfc.willing = I40E_IEEE_DEFAULT_PFC_WILLING; in i40e_dcb_sw_default_config()
6957 pf->tmp_cfg.pfc.pfccap = I40E_MAX_TRAFFIC_CLASS; in i40e_dcb_sw_default_config()
6959 pf->tmp_cfg.numapps = I40E_IEEE_DEFAULT_NUM_APPS; in i40e_dcb_sw_default_config()
6960 pf->tmp_cfg.app[0].selector = I40E_APP_SEL_ETHTYPE; in i40e_dcb_sw_default_config()
6961 pf->tmp_cfg.app[0].priority = I40E_IEEE_DEFAULT_APP_PRIO; in i40e_dcb_sw_default_config()
6962 pf->tmp_cfg.app[0].protocolid = I40E_APP_PROTOID_FCOE; in i40e_dcb_sw_default_config()
6964 return i40e_hw_set_dcb_config(pf, &pf->tmp_cfg); in i40e_dcb_sw_default_config()
6974 (hw, pf->mac_seid, &ets_data, in i40e_dcb_sw_default_config()
6977 dev_info(&pf->pdev->dev, in i40e_dcb_sw_default_config()
6979 i40e_stat_str(&pf->hw, err), in i40e_dcb_sw_default_config()
6980 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_dcb_sw_default_config()
7002 static int i40e_init_pf_dcb(struct i40e_pf *pf) in i40e_init_pf_dcb() argument
7004 struct i40e_hw *hw = &pf->hw; in i40e_init_pf_dcb()
7010 if (pf->hw_features & I40E_HW_NO_DCB_SUPPORT) { in i40e_init_pf_dcb()
7011 dev_info(&pf->pdev->dev, "DCB is not supported.\n"); in i40e_init_pf_dcb()
7015 if (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) { in i40e_init_pf_dcb()
7016 dev_info(&pf->pdev->dev, "FW LLDP is disabled, attempting SW DCB\n"); in i40e_init_pf_dcb()
7017 err = i40e_dcb_sw_default_config(pf); in i40e_init_pf_dcb()
7019 dev_info(&pf->pdev->dev, "Could not initialize SW DCB\n"); in i40e_init_pf_dcb()
7022 dev_info(&pf->pdev->dev, "SW DCB initialization succeeded.\n"); in i40e_init_pf_dcb()
7023 pf->dcbx_cap = DCB_CAP_DCBX_HOST | in i40e_init_pf_dcb()
7026 pf->flags |= I40E_FLAG_DCB_CAPABLE; in i40e_init_pf_dcb()
7027 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_init_pf_dcb()
7035 dev_info(&pf->pdev->dev, in i40e_init_pf_dcb()
7039 pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED | in i40e_init_pf_dcb()
7042 pf->flags |= I40E_FLAG_DCB_CAPABLE; in i40e_init_pf_dcb()
7047 pf->flags |= I40E_FLAG_DCB_ENABLED; in i40e_init_pf_dcb()
7049 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_init_pf_dcb()
7050 dev_dbg(&pf->pdev->dev, in i40e_init_pf_dcb()
7053 } else if (pf->hw.aq.asq_last_status == I40E_AQ_RC_EPERM) { in i40e_init_pf_dcb()
7054 dev_info(&pf->pdev->dev, "FW LLDP disabled for this PF.\n"); in i40e_init_pf_dcb()
7055 pf->flags |= I40E_FLAG_DISABLE_FW_LLDP; in i40e_init_pf_dcb()
7057 dev_info(&pf->pdev->dev, in i40e_init_pf_dcb()
7059 i40e_stat_str(&pf->hw, err), in i40e_init_pf_dcb()
7060 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_init_pf_dcb()
7076 struct i40e_pf *pf = vsi->back; in i40e_print_link_message() local
7084 new_speed = pf->hw.phy.link_info.link_speed; in i40e_print_link_message()
7100 if (pf->hw.func_caps.npar_enable && in i40e_print_link_message()
7101 (pf->hw.phy.link_info.link_speed == I40E_LINK_SPEED_1GB || in i40e_print_link_message()
7102 pf->hw.phy.link_info.link_speed == I40E_LINK_SPEED_100MB)) in i40e_print_link_message()
7106 switch (pf->hw.phy.link_info.link_speed) { in i40e_print_link_message()
7135 switch (pf->hw.fc.current_mode) { in i40e_print_link_message()
7150 if (pf->hw.phy.link_info.link_speed == I40E_LINK_SPEED_25GB) { in i40e_print_link_message()
7155 if (pf->hw.phy.link_info.an_info & I40E_AQ_AN_COMPLETED) in i40e_print_link_message()
7158 if (pf->hw.phy.link_info.fec_info & in i40e_print_link_message()
7161 else if (pf->hw.phy.link_info.fec_info & in i40e_print_link_message()
7179 } else if (pf->hw.device_id == I40E_DEV_ID_KX_X722) { in i40e_print_link_message()
7184 if (pf->hw.phy.link_info.an_info & I40E_AQ_AN_COMPLETED) in i40e_print_link_message()
7187 if (pf->hw.phy.link_info.fec_info & in i40e_print_link_message()
7191 if (pf->hw.phy.link_info.req_fec_info & in i40e_print_link_message()
7212 struct i40e_pf *pf = vsi->back; in i40e_up_complete() local
7215 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_up_complete()
7229 if ((pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP) && in i40e_up_complete()
7239 pf->fd_add_err = 0; in i40e_up_complete()
7240 pf->fd_atr_cnt = 0; in i40e_up_complete()
7247 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_up_complete()
7248 i40e_service_event_schedule(pf); in i40e_up_complete()
7262 struct i40e_pf *pf = vsi->back; in i40e_vsi_reinit_locked() local
7264 while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) in i40e_vsi_reinit_locked()
7269 clear_bit(__I40E_CONFIG_BUSY, pf->state); in i40e_vsi_reinit_locked()
7277 static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up) in i40e_force_link_state() argument
7282 struct i40e_hw *hw = &pf->hw; in i40e_force_link_state()
7296 dev_err(&pf->pdev->dev, in i40e_force_link_state()
7308 dev_err(&pf->pdev->dev, in i40e_force_link_state()
7319 if (pf->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED) in i40e_force_link_state()
7335 if (pf->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED) { in i40e_force_link_state()
7353 dev_err(&pf->pdev->dev, in i40e_force_link_state()
7355 i40e_stat_str(&pf->hw, err), in i40e_force_link_state()
7356 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_force_link_state()
7641 struct i40e_pf *pf = vsi->back; in i40e_fwd_ring_up() local
7642 struct i40e_hw *hw = &pf->hw; in i40e_fwd_ring_up()
7694 dev_info(&pf->pdev->dev, in i40e_fwd_ring_up()
7714 struct i40e_pf *pf = vsi->back; in i40e_setup_macvlans() local
7715 struct i40e_hw *hw = &pf->hw; in i40e_setup_macvlans()
7751 dev_info(&pf->pdev->dev, in i40e_setup_macvlans()
7767 dev_info(&pf->pdev->dev, in i40e_setup_macvlans()
7787 if (!i40e_setup_channel(pf, vsi, ch)) { in i40e_setup_macvlans()
7801 dev_info(&pf->pdev->dev, "Failed to setup macvlans\n"); in i40e_setup_macvlans()
7817 struct i40e_pf *pf = vsi->back; in i40e_fwd_add() local
7821 if ((pf->flags & I40E_FLAG_DCB_ENABLED)) { in i40e_fwd_add()
7825 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_fwd_add()
7829 if (pf->num_lan_msix < I40E_MIN_MACVLAN_VECTORS) { in i40e_fwd_add()
7848 vectors = pf->num_lan_msix; in i40e_fwd_add()
7925 struct i40e_pf *pf = vsi->back; in i40e_del_all_macvlans() local
7926 struct i40e_hw *hw = &pf->hw; in i40e_del_all_macvlans()
7962 struct i40e_pf *pf = vsi->back; in i40e_fwd_del() local
7963 struct i40e_hw *hw = &pf->hw; in i40e_fwd_del()
7983 dev_info(&pf->pdev->dev, in i40e_fwd_del()
8003 struct i40e_pf *pf = vsi->back; in i40e_setup_tc() local
8016 pf->flags &= ~I40E_FLAG_TC_MQPRIO; in i40e_setup_tc()
8022 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_setup_tc()
8029 pf->flags &= ~I40E_FLAG_TC_MQPRIO; in i40e_setup_tc()
8032 if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) { in i40e_setup_tc()
8039 if (num_tc > i40e_pf_get_num_tc(pf)) { in i40e_setup_tc()
8046 if (pf->flags & I40E_FLAG_DCB_ENABLED) { in i40e_setup_tc()
8051 if (!(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_setup_tc()
8058 pf->flags |= I40E_FLAG_TC_MQPRIO; in i40e_setup_tc()
8059 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_setup_tc()
8078 if (!hw && !i40e_is_tc_mqprio_enabled(pf)) in i40e_setup_tc()
8102 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_setup_tc()
8200 struct i40e_pf *pf = vsi->back; in i40e_add_del_cloud_filter() local
8239 ret = i40e_aq_add_cloud_filters(&pf->hw, filter->seid, in i40e_add_del_cloud_filter()
8242 ret = i40e_aq_rem_cloud_filters(&pf->hw, filter->seid, in i40e_add_del_cloud_filter()
8245 dev_dbg(&pf->pdev->dev, in i40e_add_del_cloud_filter()
8248 pf->hw.aq.asq_last_status); in i40e_add_del_cloud_filter()
8250 dev_info(&pf->pdev->dev, in i40e_add_del_cloud_filter()
8270 struct i40e_pf *pf = vsi->back; in i40e_add_del_cloud_filter_big_buf() local
8328 dev_err(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8341 dev_err(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8347 ret = i40e_aq_add_cloud_filters_bb(&pf->hw, filter->seid, in i40e_add_del_cloud_filter_big_buf()
8350 ret = i40e_aq_rem_cloud_filters_bb(&pf->hw, filter->seid, in i40e_add_del_cloud_filter_big_buf()
8355 dev_dbg(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8357 add ? "add" : "delete", ret, pf->hw.aq.asq_last_status); in i40e_add_del_cloud_filter_big_buf()
8359 dev_info(&pf->pdev->dev, in i40e_add_del_cloud_filter_big_buf()
8380 struct i40e_pf *pf = vsi->back; in i40e_parse_cls_flower() local
8392 dev_err(&pf->pdev->dev, "Unsupported key used: 0x%x\n", in i40e_parse_cls_flower()
8432 dev_err(&pf->pdev->dev, "Bad ether dest mask %pM\n", in i40e_parse_cls_flower()
8442 dev_err(&pf->pdev->dev, "Bad ether src mask %pM\n", in i40e_parse_cls_flower()
8460 dev_err(&pf->pdev->dev, "Bad vlan mask 0x%04x\n", in i40e_parse_cls_flower()
8484 dev_err(&pf->pdev->dev, "Bad ip dst mask %pI4b\n", in i40e_parse_cls_flower()
8494 dev_err(&pf->pdev->dev, "Bad ip src mask %pI4b\n", in i40e_parse_cls_flower()
8501 dev_err(&pf->pdev->dev, "Tenant id not allowed for ip filter\n"); in i40e_parse_cls_flower()
8518 dev_err(&pf->pdev->dev, in i40e_parse_cls_flower()
8540 dev_err(&pf->pdev->dev, "Bad src port mask 0x%04x\n", in i40e_parse_cls_flower()
8550 dev_err(&pf->pdev->dev, "Bad dst port mask 0x%04x\n", in i40e_parse_cls_flower()
8564 dev_err(&pf->pdev->dev, in i40e_parse_cls_flower()
8619 struct i40e_pf *pf = vsi->back; in i40e_configure_clsflower() local
8628 dev_err(&pf->pdev->dev, "Unable to add filter because of invalid destination"); in i40e_configure_clsflower()
8632 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) || in i40e_configure_clsflower()
8633 test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) in i40e_configure_clsflower()
8636 if (pf->fdir_pf_active_filters || in i40e_configure_clsflower()
8637 (!hlist_empty(&pf->fdir_filter_list))) { in i40e_configure_clsflower()
8671 dev_err(&pf->pdev->dev, "Failed to add cloud filter, err %d\n", in i40e_configure_clsflower()
8679 hlist_add_head(&filter->cloud_node, &pf->cloud_filter_list); in i40e_configure_clsflower()
8681 pf->num_cloud_filters++; in i40e_configure_clsflower()
8718 struct i40e_pf *pf = vsi->back; in i40e_delete_clsflower() local
8735 dev_err(&pf->pdev->dev, in i40e_delete_clsflower()
8737 i40e_stat_str(&pf->hw, err)); in i40e_delete_clsflower()
8738 return i40e_aq_rc_to_posix(err, pf->hw.aq.asq_last_status); in i40e_delete_clsflower()
8741 pf->num_cloud_filters--; in i40e_delete_clsflower()
8742 if (!pf->num_cloud_filters) in i40e_delete_clsflower()
8743 if ((pf->flags & I40E_FLAG_FD_SB_TO_CLOUD_FILTER) && in i40e_delete_clsflower()
8744 !(pf->flags & I40E_FLAG_FD_SB_INACTIVE)) { in i40e_delete_clsflower()
8745 pf->flags |= I40E_FLAG_FD_SB_ENABLED; in i40e_delete_clsflower()
8746 pf->flags &= ~I40E_FLAG_FD_SB_TO_CLOUD_FILTER; in i40e_delete_clsflower()
8747 pf->flags &= ~I40E_FLAG_FD_SB_INACTIVE; in i40e_delete_clsflower()
8827 struct i40e_pf *pf = vsi->back; in i40e_open() local
8831 if (test_bit(__I40E_TESTING, pf->state) || in i40e_open()
8832 test_bit(__I40E_BAD_EEPROM, pf->state)) in i40e_open()
8837 if (i40e_force_link_state(pf, true)) in i40e_open()
8845 wr32(&pf->hw, I40E_GLLAN_TSOMSK_F, be32_to_cpu(TCP_FLAG_PSH | in i40e_open()
8847 wr32(&pf->hw, I40E_GLLAN_TSOMSK_M, be32_to_cpu(TCP_FLAG_PSH | in i40e_open()
8850 wr32(&pf->hw, I40E_GLLAN_TSOMSK_L, be32_to_cpu(TCP_FLAG_CWR) >> 16); in i40e_open()
8889 struct i40e_pf *pf = vsi->back; in i40e_vsi_open() local
8907 dev_driver_string(&pf->pdev->dev), vsi->netdev->name); in i40e_vsi_open()
8919 dev_driver_string(&pf->pdev->dev), in i40e_vsi_open()
8920 dev_name(&pf->pdev->dev)); in i40e_vsi_open()
8944 if (vsi == pf->vsi[pf->lan_vsi]) in i40e_vsi_open()
8945 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_vsi_open()
8957 static void i40e_fdir_filter_exit(struct i40e_pf *pf) in i40e_fdir_filter_exit() argument
8964 &pf->fdir_filter_list, fdir_node) { in i40e_fdir_filter_exit()
8969 list_for_each_entry_safe(pit_entry, tmp, &pf->l3_flex_pit_list, list) { in i40e_fdir_filter_exit()
8973 INIT_LIST_HEAD(&pf->l3_flex_pit_list); in i40e_fdir_filter_exit()
8975 list_for_each_entry_safe(pit_entry, tmp, &pf->l4_flex_pit_list, list) { in i40e_fdir_filter_exit()
8979 INIT_LIST_HEAD(&pf->l4_flex_pit_list); in i40e_fdir_filter_exit()
8981 pf->fdir_pf_active_filters = 0; in i40e_fdir_filter_exit()
8982 i40e_reset_fdir_filter_cnt(pf); in i40e_fdir_filter_exit()
8985 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_TCP, in i40e_fdir_filter_exit()
8990 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_TCP, in i40e_fdir_filter_exit()
8995 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_UDP, in i40e_fdir_filter_exit()
9000 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_UDP, in i40e_fdir_filter_exit()
9005 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_SCTP, in i40e_fdir_filter_exit()
9010 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_SCTP, in i40e_fdir_filter_exit()
9015 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_OTHER, in i40e_fdir_filter_exit()
9018 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV4, in i40e_fdir_filter_exit()
9022 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV6_OTHER, in i40e_fdir_filter_exit()
9025 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV6, in i40e_fdir_filter_exit()
9036 static void i40e_cloud_filter_exit(struct i40e_pf *pf) in i40e_cloud_filter_exit() argument
9042 &pf->cloud_filter_list, cloud_node) { in i40e_cloud_filter_exit()
9046 pf->num_cloud_filters = 0; in i40e_cloud_filter_exit()
9048 if ((pf->flags & I40E_FLAG_FD_SB_TO_CLOUD_FILTER) && in i40e_cloud_filter_exit()
9049 !(pf->flags & I40E_FLAG_FD_SB_INACTIVE)) { in i40e_cloud_filter_exit()
9050 pf->flags |= I40E_FLAG_FD_SB_ENABLED; in i40e_cloud_filter_exit()
9051 pf->flags &= ~I40E_FLAG_FD_SB_TO_CLOUD_FILTER; in i40e_cloud_filter_exit()
9052 pf->flags &= ~I40E_FLAG_FD_SB_INACTIVE; in i40e_cloud_filter_exit()
9087 void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags, bool lock_acquired) in i40e_do_reset() argument
9102 dev_dbg(&pf->pdev->dev, "GlobalR requested\n"); in i40e_do_reset()
9103 val = rd32(&pf->hw, I40E_GLGEN_RTRIG); in i40e_do_reset()
9105 wr32(&pf->hw, I40E_GLGEN_RTRIG, val); in i40e_do_reset()
9113 dev_dbg(&pf->pdev->dev, "CoreR requested\n"); in i40e_do_reset()
9114 val = rd32(&pf->hw, I40E_GLGEN_RTRIG); in i40e_do_reset()
9116 wr32(&pf->hw, I40E_GLGEN_RTRIG, val); in i40e_do_reset()
9117 i40e_flush(&pf->hw); in i40e_do_reset()
9129 dev_dbg(&pf->pdev->dev, "PFR requested\n"); in i40e_do_reset()
9130 i40e_handle_reset_warning(pf, lock_acquired); in i40e_do_reset()
9137 i40e_prep_for_reset(pf); in i40e_do_reset()
9138 i40e_reset_and_rebuild(pf, true, lock_acquired); in i40e_do_reset()
9139 dev_info(&pf->pdev->dev, in i40e_do_reset()
9140 pf->flags & I40E_FLAG_DISABLE_FW_LLDP ? in i40e_do_reset()
9148 dev_info(&pf->pdev->dev, in i40e_do_reset()
9150 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_do_reset()
9151 struct i40e_vsi *vsi = pf->vsi[v]; in i40e_do_reset()
9156 i40e_vsi_reinit_locked(pf->vsi[v]); in i40e_do_reset()
9162 dev_info(&pf->pdev->dev, "VSI down requested\n"); in i40e_do_reset()
9163 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_do_reset()
9164 struct i40e_vsi *vsi = pf->vsi[v]; in i40e_do_reset()
9174 dev_info(&pf->pdev->dev, in i40e_do_reset()
9186 bool i40e_dcb_need_reconfig(struct i40e_pf *pf, in i40e_dcb_need_reconfig() argument
9201 dev_dbg(&pf->pdev->dev, "ETS UP2TC changed.\n"); in i40e_dcb_need_reconfig()
9207 dev_dbg(&pf->pdev->dev, "ETS TC BW Table changed.\n"); in i40e_dcb_need_reconfig()
9212 dev_dbg(&pf->pdev->dev, "ETS TSA Table changed.\n"); in i40e_dcb_need_reconfig()
9220 dev_dbg(&pf->pdev->dev, "PFC config change detected.\n"); in i40e_dcb_need_reconfig()
9228 dev_dbg(&pf->pdev->dev, "APP Table change detected.\n"); in i40e_dcb_need_reconfig()
9231 dev_dbg(&pf->pdev->dev, "dcb need_reconfig=%d\n", need_reconfig); in i40e_dcb_need_reconfig()
9240 static int i40e_handle_lldp_event(struct i40e_pf *pf, in i40e_handle_lldp_event() argument
9245 struct i40e_hw *hw = &pf->hw; in i40e_handle_lldp_event()
9255 !(pf->flags & I40E_FLAG_DCB_CAPABLE)) in i40e_handle_lldp_event()
9257 pf->flags |= I40E_FLAG_DCB_CAPABLE; in i40e_handle_lldp_event()
9260 if (!(pf->flags & I40E_FLAG_DCB_CAPABLE)) in i40e_handle_lldp_event()
9266 dev_dbg(&pf->pdev->dev, "LLDP event mib bridge type 0x%x\n", type); in i40e_handle_lldp_event()
9272 dev_dbg(&pf->pdev->dev, in i40e_handle_lldp_event()
9288 ret = i40e_get_dcb_config(&pf->hw); in i40e_handle_lldp_event()
9294 dev_warn(&pf->pdev->dev, in i40e_handle_lldp_event()
9296 pf->flags &= ~I40E_FLAG_DCB_CAPABLE; in i40e_handle_lldp_event()
9298 dev_info(&pf->pdev->dev, in i40e_handle_lldp_event()
9300 i40e_stat_str(&pf->hw, ret), in i40e_handle_lldp_event()
9301 i40e_aq_str(&pf->hw, in i40e_handle_lldp_event()
9302 pf->hw.aq.asq_last_status)); in i40e_handle_lldp_event()
9310 dev_dbg(&pf->pdev->dev, "No change detected in DCBX configuration.\n"); in i40e_handle_lldp_event()
9314 need_reconfig = i40e_dcb_need_reconfig(pf, &tmp_dcbx_cfg, in i40e_handle_lldp_event()
9317 i40e_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &hw->local_dcbx_config); in i40e_handle_lldp_event()
9324 pf->flags |= I40E_FLAG_DCB_ENABLED; in i40e_handle_lldp_event()
9326 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_handle_lldp_event()
9328 set_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_handle_lldp_event()
9330 i40e_pf_quiesce_all_vsi(pf); in i40e_handle_lldp_event()
9333 i40e_dcb_reconfigure(pf); in i40e_handle_lldp_event()
9335 ret = i40e_resume_port_tx(pf); in i40e_handle_lldp_event()
9337 clear_bit(__I40E_PORT_SUSPENDED, pf->state); in i40e_handle_lldp_event()
9343 ret = i40e_pf_wait_queues_disabled(pf); in i40e_handle_lldp_event()
9346 set_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_handle_lldp_event()
9347 i40e_service_event_schedule(pf); in i40e_handle_lldp_event()
9349 i40e_pf_unquiesce_all_vsi(pf); in i40e_handle_lldp_event()
9350 set_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state); in i40e_handle_lldp_event()
9351 set_bit(__I40E_CLIENT_L2_CHANGE, pf->state); in i40e_handle_lldp_event()
9365 void i40e_do_reset_safe(struct i40e_pf *pf, u32 reset_flags) in i40e_do_reset_safe() argument
9368 i40e_do_reset(pf, reset_flags, true); in i40e_do_reset_safe()
9380 static void i40e_handle_lan_overflow_event(struct i40e_pf *pf, in i40e_handle_lan_overflow_event() argument
9387 struct i40e_hw *hw = &pf->hw; in i40e_handle_lan_overflow_event()
9391 dev_dbg(&pf->pdev->dev, "overflow Rx Queue Number = %d QTX_CTL=0x%08x\n", in i40e_handle_lan_overflow_event()
9400 vf = &pf->vf[vf_id]; in i40e_handle_lan_overflow_event()
9412 u32 i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf) in i40e_get_cur_guaranteed_fd_count() argument
9416 val = rd32(&pf->hw, I40E_PFQF_FDSTAT); in i40e_get_cur_guaranteed_fd_count()
9425 u32 i40e_get_current_fd_count(struct i40e_pf *pf) in i40e_get_current_fd_count() argument
9429 val = rd32(&pf->hw, I40E_PFQF_FDSTAT); in i40e_get_current_fd_count()
9440 u32 i40e_get_global_fd_count(struct i40e_pf *pf) in i40e_get_global_fd_count() argument
9444 val = rd32(&pf->hw, I40E_GLQF_FDCNT_0); in i40e_get_global_fd_count()
9455 static void i40e_reenable_fdir_sb(struct i40e_pf *pf) in i40e_reenable_fdir_sb() argument
9457 if (test_and_clear_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state)) in i40e_reenable_fdir_sb()
9458 if ((pf->flags & I40E_FLAG_FD_SB_ENABLED) && in i40e_reenable_fdir_sb()
9459 (I40E_DEBUG_FD & pf->hw.debug_mask)) in i40e_reenable_fdir_sb()
9460 …dev_info(&pf->pdev->dev, "FD Sideband/ntuple is being enabled since we have space in the table now… in i40e_reenable_fdir_sb()
9467 static void i40e_reenable_fdir_atr(struct i40e_pf *pf) in i40e_reenable_fdir_atr() argument
9469 if (test_and_clear_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state)) { in i40e_reenable_fdir_atr()
9475 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_TCP, in i40e_reenable_fdir_atr()
9479 if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) && in i40e_reenable_fdir_atr()
9480 (I40E_DEBUG_FD & pf->hw.debug_mask)) in i40e_reenable_fdir_atr()
9481 …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()
9490 static void i40e_delete_invalid_filter(struct i40e_pf *pf, in i40e_delete_invalid_filter() argument
9494 pf->fdir_pf_active_filters--; in i40e_delete_invalid_filter()
9495 pf->fd_inv = 0; in i40e_delete_invalid_filter()
9499 pf->fd_tcp4_filter_cnt--; in i40e_delete_invalid_filter()
9502 pf->fd_udp4_filter_cnt--; in i40e_delete_invalid_filter()
9505 pf->fd_sctp4_filter_cnt--; in i40e_delete_invalid_filter()
9508 pf->fd_tcp6_filter_cnt--; in i40e_delete_invalid_filter()
9511 pf->fd_udp6_filter_cnt--; in i40e_delete_invalid_filter()
9514 pf->fd_udp6_filter_cnt--; in i40e_delete_invalid_filter()
9519 pf->fd_tcp4_filter_cnt--; in i40e_delete_invalid_filter()
9522 pf->fd_udp4_filter_cnt--; in i40e_delete_invalid_filter()
9525 pf->fd_sctp4_filter_cnt--; in i40e_delete_invalid_filter()
9528 pf->fd_ip4_filter_cnt--; in i40e_delete_invalid_filter()
9535 pf->fd_tcp6_filter_cnt--; in i40e_delete_invalid_filter()
9538 pf->fd_udp6_filter_cnt--; in i40e_delete_invalid_filter()
9541 pf->fd_sctp6_filter_cnt--; in i40e_delete_invalid_filter()
9544 pf->fd_ip6_filter_cnt--; in i40e_delete_invalid_filter()
9559 void i40e_fdir_check_and_reenable(struct i40e_pf *pf) in i40e_fdir_check_and_reenable() argument
9565 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state)) in i40e_fdir_check_and_reenable()
9569 fcnt_prog = i40e_get_global_fd_count(pf); in i40e_fdir_check_and_reenable()
9570 fcnt_avail = pf->fdir_pf_filter_count; in i40e_fdir_check_and_reenable()
9572 (pf->fd_add_err == 0) || in i40e_fdir_check_and_reenable()
9573 (i40e_get_current_atr_cnt(pf) < pf->fd_atr_cnt)) in i40e_fdir_check_and_reenable()
9574 i40e_reenable_fdir_sb(pf); in i40e_fdir_check_and_reenable()
9581 pf->fd_tcp4_filter_cnt == 0 && pf->fd_tcp6_filter_cnt == 0) in i40e_fdir_check_and_reenable()
9582 i40e_reenable_fdir_atr(pf); in i40e_fdir_check_and_reenable()
9585 if (pf->fd_inv > 0) { in i40e_fdir_check_and_reenable()
9587 &pf->fdir_filter_list, fdir_node) in i40e_fdir_check_and_reenable()
9588 if (filter->fd_id == pf->fd_inv) in i40e_fdir_check_and_reenable()
9589 i40e_delete_invalid_filter(pf, filter); in i40e_fdir_check_and_reenable()
9599 static void i40e_fdir_flush_and_replay(struct i40e_pf *pf) in i40e_fdir_flush_and_replay() argument
9607 if (!time_after(jiffies, pf->fd_flush_timestamp + in i40e_fdir_flush_and_replay()
9614 min_flush_time = pf->fd_flush_timestamp + in i40e_fdir_flush_and_replay()
9616 fd_room = pf->fdir_pf_filter_count - pf->fdir_pf_active_filters; in i40e_fdir_flush_and_replay()
9620 if (I40E_DEBUG_FD & pf->hw.debug_mask) in i40e_fdir_flush_and_replay()
9621 dev_info(&pf->pdev->dev, "ATR disabled, not enough FD filter space.\n"); in i40e_fdir_flush_and_replay()
9625 pf->fd_flush_timestamp = jiffies; in i40e_fdir_flush_and_replay()
9626 set_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state); in i40e_fdir_flush_and_replay()
9628 wr32(&pf->hw, I40E_PFQF_CTL_1, in i40e_fdir_flush_and_replay()
9630 i40e_flush(&pf->hw); in i40e_fdir_flush_and_replay()
9631 pf->fd_flush_cnt++; in i40e_fdir_flush_and_replay()
9632 pf->fd_add_err = 0; in i40e_fdir_flush_and_replay()
9636 reg = rd32(&pf->hw, I40E_PFQF_CTL_1); in i40e_fdir_flush_and_replay()
9641 dev_warn(&pf->pdev->dev, "FD table did not flush, needs more time\n"); in i40e_fdir_flush_and_replay()
9644 i40e_fdir_filter_restore(pf->vsi[pf->lan_vsi]); in i40e_fdir_flush_and_replay()
9645 if (!disable_atr && !pf->fd_tcp4_filter_cnt) in i40e_fdir_flush_and_replay()
9646 clear_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state); in i40e_fdir_flush_and_replay()
9647 clear_bit(__I40E_FD_FLUSH_REQUESTED, pf->state); in i40e_fdir_flush_and_replay()
9648 if (I40E_DEBUG_FD & pf->hw.debug_mask) in i40e_fdir_flush_and_replay()
9649 dev_info(&pf->pdev->dev, "FD Filter table flushed and FD-SB replayed.\n"); in i40e_fdir_flush_and_replay()
9657 u32 i40e_get_current_atr_cnt(struct i40e_pf *pf) in i40e_get_current_atr_cnt() argument
9659 return i40e_get_current_fd_count(pf) - pf->fdir_pf_active_filters; in i40e_get_current_atr_cnt()
9666 static void i40e_fdir_reinit_subtask(struct i40e_pf *pf) in i40e_fdir_reinit_subtask() argument
9670 if (test_bit(__I40E_DOWN, pf->state)) in i40e_fdir_reinit_subtask()
9673 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state)) in i40e_fdir_reinit_subtask()
9674 i40e_fdir_flush_and_replay(pf); in i40e_fdir_reinit_subtask()
9676 i40e_fdir_check_and_reenable(pf); in i40e_fdir_reinit_subtask()
9722 struct i40e_pf *pf; in i40e_veb_link_event() local
9725 if (!veb || !veb->pf) in i40e_veb_link_event()
9727 pf = veb->pf; in i40e_veb_link_event()
9731 if (pf->veb[i] && (pf->veb[i]->uplink_seid == veb->seid)) in i40e_veb_link_event()
9732 i40e_veb_link_event(pf->veb[i], link_up); in i40e_veb_link_event()
9735 for (i = 0; i < pf->num_alloc_vsi; i++) in i40e_veb_link_event()
9736 if (pf->vsi[i] && (pf->vsi[i]->uplink_seid == veb->seid)) in i40e_veb_link_event()
9737 i40e_vsi_link_event(pf->vsi[i], link_up); in i40e_veb_link_event()
9744 static void i40e_link_event(struct i40e_pf *pf) in i40e_link_event() argument
9746 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_link_event()
9755 pf->hw.phy.get_link_info = true; in i40e_link_event()
9756 old_link = (pf->hw.phy.link_info_old.link_info & I40E_AQ_LINK_UP); in i40e_link_event()
9757 status = i40e_get_link_status(&pf->hw, &new_link); in i40e_link_event()
9761 clear_bit(__I40E_TEMP_LINK_POLLING, pf->state); in i40e_link_event()
9766 set_bit(__I40E_TEMP_LINK_POLLING, pf->state); in i40e_link_event()
9767 dev_dbg(&pf->pdev->dev, "couldn't get link state, status: %d\n", in i40e_link_event()
9772 old_link_speed = pf->hw.phy.link_info_old.link_speed; in i40e_link_event()
9773 new_link_speed = pf->hw.phy.link_info.link_speed; in i40e_link_event()
9786 if (pf->lan_veb < I40E_MAX_VEB && pf->veb[pf->lan_veb]) in i40e_link_event()
9787 i40e_veb_link_event(pf->veb[pf->lan_veb], new_link); in i40e_link_event()
9791 if (pf->vf) in i40e_link_event()
9792 i40e_vc_notify_link_state(pf); in i40e_link_event()
9794 if (pf->flags & I40E_FLAG_PTP) in i40e_link_event()
9795 i40e_ptp_set_increment(pf); in i40e_link_event()
9800 if (pf->dcbx_cap & DCB_CAP_DCBX_LLD_MANAGED) in i40e_link_event()
9807 dev_dbg(&pf->pdev->dev, "Reconfig DCB to single TC as result of Link Down\n"); in i40e_link_event()
9808 memset(&pf->tmp_cfg, 0, sizeof(pf->tmp_cfg)); in i40e_link_event()
9809 err = i40e_dcb_sw_default_config(pf); in i40e_link_event()
9811 pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | in i40e_link_event()
9814 pf->dcbx_cap = DCB_CAP_DCBX_HOST | in i40e_link_event()
9816 pf->flags |= I40E_FLAG_DCB_CAPABLE; in i40e_link_event()
9817 pf->flags &= ~I40E_FLAG_DCB_ENABLED; in i40e_link_event()
9827 static void i40e_watchdog_subtask(struct i40e_pf *pf) in i40e_watchdog_subtask() argument
9832 if (test_bit(__I40E_DOWN, pf->state) || in i40e_watchdog_subtask()
9833 test_bit(__I40E_CONFIG_BUSY, pf->state)) in i40e_watchdog_subtask()
9837 if (time_before(jiffies, (pf->service_timer_previous + in i40e_watchdog_subtask()
9838 pf->service_timer_period))) in i40e_watchdog_subtask()
9840 pf->service_timer_previous = jiffies; in i40e_watchdog_subtask()
9842 if ((pf->flags & I40E_FLAG_LINK_POLLING_ENABLED) || in i40e_watchdog_subtask()
9843 test_bit(__I40E_TEMP_LINK_POLLING, pf->state)) in i40e_watchdog_subtask()
9844 i40e_link_event(pf); in i40e_watchdog_subtask()
9849 for (i = 0; i < pf->num_alloc_vsi; i++) in i40e_watchdog_subtask()
9850 if (pf->vsi[i] && pf->vsi[i]->netdev) in i40e_watchdog_subtask()
9851 i40e_update_stats(pf->vsi[i]); in i40e_watchdog_subtask()
9853 if (pf->flags & I40E_FLAG_VEB_STATS_ENABLED) { in i40e_watchdog_subtask()
9856 if (pf->veb[i]) in i40e_watchdog_subtask()
9857 i40e_update_veb_stats(pf->veb[i]); in i40e_watchdog_subtask()
9860 i40e_ptp_rx_hang(pf); in i40e_watchdog_subtask()
9861 i40e_ptp_tx_hang(pf); in i40e_watchdog_subtask()
9868 static void i40e_reset_subtask(struct i40e_pf *pf) in i40e_reset_subtask() argument
9872 if (test_bit(__I40E_REINIT_REQUESTED, pf->state)) { in i40e_reset_subtask()
9874 clear_bit(__I40E_REINIT_REQUESTED, pf->state); in i40e_reset_subtask()
9876 if (test_bit(__I40E_PF_RESET_REQUESTED, pf->state)) { in i40e_reset_subtask()
9878 clear_bit(__I40E_PF_RESET_REQUESTED, pf->state); in i40e_reset_subtask()
9880 if (test_bit(__I40E_CORE_RESET_REQUESTED, pf->state)) { in i40e_reset_subtask()
9882 clear_bit(__I40E_CORE_RESET_REQUESTED, pf->state); in i40e_reset_subtask()
9884 if (test_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state)) { in i40e_reset_subtask()
9886 clear_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state); in i40e_reset_subtask()
9888 if (test_bit(__I40E_DOWN_REQUESTED, pf->state)) { in i40e_reset_subtask()
9890 clear_bit(__I40E_DOWN_REQUESTED, pf->state); in i40e_reset_subtask()
9896 if (test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) { in i40e_reset_subtask()
9897 i40e_prep_for_reset(pf); in i40e_reset_subtask()
9898 i40e_reset(pf); in i40e_reset_subtask()
9899 i40e_rebuild(pf, false, false); in i40e_reset_subtask()
9904 !test_bit(__I40E_DOWN, pf->state) && in i40e_reset_subtask()
9905 !test_bit(__I40E_CONFIG_BUSY, pf->state)) { in i40e_reset_subtask()
9906 i40e_do_reset(pf, reset_flags, false); in i40e_reset_subtask()
9915 static void i40e_handle_link_event(struct i40e_pf *pf, in i40e_handle_link_event() argument
9927 i40e_link_event(pf); in i40e_handle_link_event()
9931 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
9933 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
9942 (!(pf->flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED))) { in i40e_handle_link_event()
9943 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
9945 dev_err(&pf->pdev->dev, in i40e_handle_link_event()
9955 static void i40e_clean_adminq_subtask(struct i40e_pf *pf) in i40e_clean_adminq_subtask() argument
9958 struct i40e_hw *hw = &pf->hw; in i40e_clean_adminq_subtask()
9966 if (test_bit(__I40E_RESET_FAILED, pf->state)) in i40e_clean_adminq_subtask()
9970 val = rd32(&pf->hw, pf->hw.aq.arq.len); in i40e_clean_adminq_subtask()
9974 dev_info(&pf->pdev->dev, "ARQ VF Error detected\n"); in i40e_clean_adminq_subtask()
9979 dev_info(&pf->pdev->dev, "ARQ Overflow Error detected\n"); in i40e_clean_adminq_subtask()
9981 pf->arq_overflows++; in i40e_clean_adminq_subtask()
9985 dev_info(&pf->pdev->dev, "ARQ Critical Error detected\n"); in i40e_clean_adminq_subtask()
9989 wr32(&pf->hw, pf->hw.aq.arq.len, val); in i40e_clean_adminq_subtask()
9991 val = rd32(&pf->hw, pf->hw.aq.asq.len); in i40e_clean_adminq_subtask()
9994 if (pf->hw.debug_mask & I40E_DEBUG_AQ) in i40e_clean_adminq_subtask()
9995 dev_info(&pf->pdev->dev, "ASQ VF Error detected\n"); in i40e_clean_adminq_subtask()
9999 if (pf->hw.debug_mask & I40E_DEBUG_AQ) in i40e_clean_adminq_subtask()
10000 dev_info(&pf->pdev->dev, "ASQ Overflow Error detected\n"); in i40e_clean_adminq_subtask()
10004 if (pf->hw.debug_mask & I40E_DEBUG_AQ) in i40e_clean_adminq_subtask()
10005 dev_info(&pf->pdev->dev, "ASQ Critical Error detected\n"); in i40e_clean_adminq_subtask()
10009 wr32(&pf->hw, pf->hw.aq.asq.len, val); in i40e_clean_adminq_subtask()
10021 dev_info(&pf->pdev->dev, "ARQ event error %d\n", ret); in i40e_clean_adminq_subtask()
10030 i40e_handle_link_event(pf, &event); in i40e_clean_adminq_subtask()
10034 ret = i40e_vc_process_vf_msg(pf, in i40e_clean_adminq_subtask()
10042 dev_dbg(&pf->pdev->dev, "ARQ: Update LLDP MIB event received\n"); in i40e_clean_adminq_subtask()
10045 i40e_handle_lldp_event(pf, &event); in i40e_clean_adminq_subtask()
10050 dev_dbg(&pf->pdev->dev, "ARQ LAN queue overflow event received\n"); in i40e_clean_adminq_subtask()
10051 i40e_handle_lan_overflow_event(pf, &event); in i40e_clean_adminq_subtask()
10054 dev_info(&pf->pdev->dev, "ARQ: Msg from other pf\n"); in i40e_clean_adminq_subtask()
10059 i40e_debug(&pf->hw, I40E_DEBUG_NVM, in i40e_clean_adminq_subtask()
10064 dev_info(&pf->pdev->dev, in i40e_clean_adminq_subtask()
10069 } while (i++ < pf->adminq_work_limit); in i40e_clean_adminq_subtask()
10071 if (i < pf->adminq_work_limit) in i40e_clean_adminq_subtask()
10072 clear_bit(__I40E_ADMINQ_EVENT_PENDING, pf->state); in i40e_clean_adminq_subtask()
10087 static void i40e_verify_eeprom(struct i40e_pf *pf) in i40e_verify_eeprom() argument
10091 err = i40e_diag_eeprom_test(&pf->hw); in i40e_verify_eeprom()
10094 err = i40e_diag_eeprom_test(&pf->hw); in i40e_verify_eeprom()
10096 dev_info(&pf->pdev->dev, "eeprom check failed (%d), Tx/Rx traffic disabled\n", in i40e_verify_eeprom()
10098 set_bit(__I40E_BAD_EEPROM, pf->state); in i40e_verify_eeprom()
10102 if (!err && test_bit(__I40E_BAD_EEPROM, pf->state)) { in i40e_verify_eeprom()
10103 dev_info(&pf->pdev->dev, "eeprom check passed, Tx/Rx traffic enabled\n"); in i40e_verify_eeprom()
10104 clear_bit(__I40E_BAD_EEPROM, pf->state); in i40e_verify_eeprom()
10114 static void i40e_enable_pf_switch_lb(struct i40e_pf *pf) in i40e_enable_pf_switch_lb() argument
10116 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_enable_pf_switch_lb()
10120 ctxt.seid = pf->main_vsi_seid; in i40e_enable_pf_switch_lb()
10121 ctxt.pf_num = pf->hw.pf_id; in i40e_enable_pf_switch_lb()
10123 ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); in i40e_enable_pf_switch_lb()
10125 dev_info(&pf->pdev->dev, in i40e_enable_pf_switch_lb()
10127 i40e_stat_str(&pf->hw, ret), in i40e_enable_pf_switch_lb()
10128 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_enable_pf_switch_lb()
10137 dev_info(&pf->pdev->dev, in i40e_enable_pf_switch_lb()
10139 i40e_stat_str(&pf->hw, ret), in i40e_enable_pf_switch_lb()
10140 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_enable_pf_switch_lb()
10150 static void i40e_disable_pf_switch_lb(struct i40e_pf *pf) in i40e_disable_pf_switch_lb() argument
10152 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_disable_pf_switch_lb()
10156 ctxt.seid = pf->main_vsi_seid; in i40e_disable_pf_switch_lb()
10157 ctxt.pf_num = pf->hw.pf_id; in i40e_disable_pf_switch_lb()
10159 ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); in i40e_disable_pf_switch_lb()
10161 dev_info(&pf->pdev->dev, in i40e_disable_pf_switch_lb()
10163 i40e_stat_str(&pf->hw, ret), in i40e_disable_pf_switch_lb()
10164 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_disable_pf_switch_lb()
10173 dev_info(&pf->pdev->dev, in i40e_disable_pf_switch_lb()
10175 i40e_stat_str(&pf->hw, ret), in i40e_disable_pf_switch_lb()
10176 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_disable_pf_switch_lb()
10190 struct i40e_pf *pf = veb->pf; in i40e_config_bridge_mode() local
10192 if (pf->hw.debug_mask & I40E_DEBUG_LAN) in i40e_config_bridge_mode()
10193 dev_info(&pf->pdev->dev, "enabling bridge mode: %s\n", in i40e_config_bridge_mode()
10196 i40e_disable_pf_switch_lb(pf); in i40e_config_bridge_mode()
10198 i40e_enable_pf_switch_lb(pf); in i40e_config_bridge_mode()
10213 struct i40e_pf *pf = veb->pf; in i40e_reconstitute_veb() local
10218 for (v = 0; v < pf->num_alloc_vsi && !ctl_vsi; v++) { in i40e_reconstitute_veb()
10219 if (pf->vsi[v] && in i40e_reconstitute_veb()
10220 pf->vsi[v]->veb_idx == veb->idx && in i40e_reconstitute_veb()
10221 pf->vsi[v]->flags & I40E_VSI_FLAG_VEB_OWNER) { in i40e_reconstitute_veb()
10222 ctl_vsi = pf->vsi[v]; in i40e_reconstitute_veb()
10227 dev_info(&pf->pdev->dev, in i40e_reconstitute_veb()
10232 if (ctl_vsi != pf->vsi[pf->lan_vsi]) in i40e_reconstitute_veb()
10233 ctl_vsi->uplink_seid = pf->vsi[pf->lan_vsi]->uplink_seid; in i40e_reconstitute_veb()
10236 dev_info(&pf->pdev->dev, in i40e_reconstitute_veb()
10248 if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED) in i40e_reconstitute_veb()
10255 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_reconstitute_veb()
10256 if (!pf->vsi[v] || pf->vsi[v] == ctl_vsi) in i40e_reconstitute_veb()
10259 if (pf->vsi[v]->veb_idx == veb->idx) { in i40e_reconstitute_veb()
10260 struct i40e_vsi *vsi = pf->vsi[v]; in i40e_reconstitute_veb()
10265 dev_info(&pf->pdev->dev, in i40e_reconstitute_veb()
10276 if (pf->veb[veb_idx] && pf->veb[veb_idx]->veb_idx == veb->idx) { in i40e_reconstitute_veb()
10277 pf->veb[veb_idx]->uplink_seid = veb->seid; in i40e_reconstitute_veb()
10278 ret = i40e_reconstitute_veb(pf->veb[veb_idx]); in i40e_reconstitute_veb()
10293 static int i40e_get_capabilities(struct i40e_pf *pf, in i40e_get_capabilities() argument
10308 err = i40e_aq_discover_capabilities(&pf->hw, cap_buf, buf_len, in i40e_get_capabilities()
10314 if (pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) { in i40e_get_capabilities()
10317 } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK || err) { in i40e_get_capabilities()
10318 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10320 i40e_stat_str(&pf->hw, err), in i40e_get_capabilities()
10321 i40e_aq_str(&pf->hw, in i40e_get_capabilities()
10322 pf->hw.aq.asq_last_status)); in i40e_get_capabilities()
10327 if (pf->hw.debug_mask & I40E_DEBUG_USER) { in i40e_get_capabilities()
10329 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10331 pf->hw.pf_id, pf->hw.func_caps.num_vfs, in i40e_get_capabilities()
10332 pf->hw.func_caps.num_msix_vectors, in i40e_get_capabilities()
10333 pf->hw.func_caps.num_msix_vectors_vf, in i40e_get_capabilities()
10334 pf->hw.func_caps.fd_filters_guaranteed, in i40e_get_capabilities()
10335 pf->hw.func_caps.fd_filters_best_effort, in i40e_get_capabilities()
10336 pf->hw.func_caps.num_tx_qp, in i40e_get_capabilities()
10337 pf->hw.func_caps.num_vsis); in i40e_get_capabilities()
10339 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10341 pf->hw.dev_caps.switch_mode, in i40e_get_capabilities()
10342 pf->hw.dev_caps.valid_functions); in i40e_get_capabilities()
10343 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10345 pf->hw.dev_caps.sr_iov_1_1, in i40e_get_capabilities()
10346 pf->hw.dev_caps.num_vfs); in i40e_get_capabilities()
10347 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10349 pf->hw.dev_caps.num_vsis, in i40e_get_capabilities()
10350 pf->hw.dev_caps.num_rx_qp, in i40e_get_capabilities()
10351 pf->hw.dev_caps.num_tx_qp); in i40e_get_capabilities()
10355 #define DEF_NUM_VSI (1 + (pf->hw.func_caps.fcoe ? 1 : 0) \ in i40e_get_capabilities()
10356 + pf->hw.func_caps.num_vfs) in i40e_get_capabilities()
10357 if (pf->hw.revision_id == 0 && in i40e_get_capabilities()
10358 pf->hw.func_caps.num_vsis < DEF_NUM_VSI) { in i40e_get_capabilities()
10359 dev_info(&pf->pdev->dev, in i40e_get_capabilities()
10361 pf->hw.func_caps.num_vsis, DEF_NUM_VSI); in i40e_get_capabilities()
10362 pf->hw.func_caps.num_vsis = DEF_NUM_VSI; in i40e_get_capabilities()
10374 static void i40e_fdir_sb_setup(struct i40e_pf *pf) in i40e_fdir_sb_setup() argument
10381 if (!rd32(&pf->hw, I40E_GLQF_HKEY(0))) { in i40e_fdir_sb_setup()
10390 wr32(&pf->hw, I40E_GLQF_HKEY(i), hkey[i]); in i40e_fdir_sb_setup()
10393 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) in i40e_fdir_sb_setup()
10397 vsi = i40e_find_vsi_by_type(pf, I40E_VSI_FDIR); in i40e_fdir_sb_setup()
10401 vsi = i40e_vsi_setup(pf, I40E_VSI_FDIR, in i40e_fdir_sb_setup()
10402 pf->vsi[pf->lan_vsi]->seid, 0); in i40e_fdir_sb_setup()
10404 dev_info(&pf->pdev->dev, "Couldn't create FDir VSI\n"); in i40e_fdir_sb_setup()
10405 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; in i40e_fdir_sb_setup()
10406 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_fdir_sb_setup()
10418 static void i40e_fdir_teardown(struct i40e_pf *pf) in i40e_fdir_teardown() argument
10422 i40e_fdir_filter_exit(pf); in i40e_fdir_teardown()
10423 vsi = i40e_find_vsi_by_type(pf, I40E_VSI_FDIR); in i40e_fdir_teardown()
10439 struct i40e_pf *pf = vsi->back; in i40e_rebuild_cloud_filters() local
10444 hlist_for_each_entry_safe(cfilter, node, &pf->cloud_filter_list, in i40e_rebuild_cloud_filters()
10456 dev_dbg(&pf->pdev->dev, in i40e_rebuild_cloud_filters()
10458 i40e_stat_str(&pf->hw, ret), in i40e_rebuild_cloud_filters()
10459 i40e_aq_str(&pf->hw, in i40e_rebuild_cloud_filters()
10460 pf->hw.aq.asq_last_status)); in i40e_rebuild_cloud_filters()
10534 static void i40e_prep_for_reset(struct i40e_pf *pf) in i40e_prep_for_reset() argument
10536 struct i40e_hw *hw = &pf->hw; in i40e_prep_for_reset()
10540 clear_bit(__I40E_RESET_INTR_RECEIVED, pf->state); in i40e_prep_for_reset()
10541 if (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_prep_for_reset()
10543 if (i40e_check_asq_alive(&pf->hw)) in i40e_prep_for_reset()
10544 i40e_vc_notify_reset(pf); in i40e_prep_for_reset()
10546 dev_dbg(&pf->pdev->dev, "Tearing down internal switch for reset\n"); in i40e_prep_for_reset()
10549 i40e_pf_quiesce_all_vsi(pf); in i40e_prep_for_reset()
10551 for (v = 0; v < pf->num_alloc_vsi; v++) { in i40e_prep_for_reset()
10552 if (pf->vsi[v]) in i40e_prep_for_reset()
10553 pf->vsi[v]->seid = 0; in i40e_prep_for_reset()
10556 i40e_shutdown_adminq(&pf->hw); in i40e_prep_for_reset()
10562 dev_warn(&pf->pdev->dev, in i40e_prep_for_reset()
10569 i40e_ptp_save_hw_time(pf); in i40e_prep_for_reset()
10576 static void i40e_send_version(struct i40e_pf *pf) in i40e_send_version() argument
10585 i40e_aq_send_driver_version(&pf->hw, &dv, NULL); in i40e_send_version()
10637 static int i40e_reset(struct i40e_pf *pf) in i40e_reset() argument
10639 struct i40e_hw *hw = &pf->hw; in i40e_reset()
10644 dev_info(&pf->pdev->dev, "PF reset failed, %d\n", ret); in i40e_reset()
10645 set_bit(__I40E_RESET_FAILED, pf->state); in i40e_reset()
10646 clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state); in i40e_reset()
10648 pf->pfr_count++; in i40e_reset()
10660 static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) in i40e_rebuild() argument
10662 const bool is_recovery_mode_reported = i40e_check_recovery_mode(pf); in i40e_rebuild()
10663 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_rebuild()
10664 struct i40e_hw *hw = &pf->hw; in i40e_rebuild()
10669 if (test_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state) && in i40e_rebuild()
10671 i40e_set_ethtool_ops(pf->vsi[pf->lan_vsi]->netdev); in i40e_rebuild()
10673 if (test_bit(__I40E_DOWN, pf->state) && in i40e_rebuild()
10674 !test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_rebuild()
10676 dev_dbg(&pf->pdev->dev, "Rebuilding internal switch\n"); in i40e_rebuild()
10679 ret = i40e_init_adminq(&pf->hw); in i40e_rebuild()
10681 dev_info(&pf->pdev->dev, "Rebuild AdminQ failed, err %s aq_err %s\n", in i40e_rebuild()
10682 i40e_stat_str(&pf->hw, ret), in i40e_rebuild()
10683 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_rebuild()
10686 i40e_get_oem_version(&pf->hw); in i40e_rebuild()
10688 if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) { in i40e_rebuild()
10694 if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) in i40e_rebuild()
10695 i40e_verify_eeprom(pf); in i40e_rebuild()
10701 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_rebuild()
10702 if (i40e_get_capabilities(pf, in i40e_rebuild()
10710 if (i40e_setup_misc_vector_for_recovery_mode(pf)) in i40e_rebuild()
10719 free_irq(pf->pdev->irq, pf); in i40e_rebuild()
10720 i40e_clear_interrupt_scheme(pf); in i40e_rebuild()
10721 if (i40e_restore_interrupt_scheme(pf)) in i40e_rebuild()
10726 i40e_send_version(pf); in i40e_rebuild()
10735 ret = i40e_get_capabilities(pf, i40e_aqc_opc_list_func_capabilities); in i40e_rebuild()
10742 dev_info(&pf->pdev->dev, "init_lan_hmc failed: %d\n", ret); in i40e_rebuild()
10747 dev_info(&pf->pdev->dev, "configure_lan_hmc failed: %d\n", ret); in i40e_rebuild()
10756 if (i40e_is_tc_mqprio_enabled(pf)) { in i40e_rebuild()
10763 dev_warn(&pf->pdev->dev, in i40e_rebuild()
10765 pf->flags &= ~I40E_FLAG_DCB_CAPABLE; in i40e_rebuild()
10768 ret = i40e_init_pf_dcb(pf); in i40e_rebuild()
10770 dev_info(&pf->pdev->dev, "DCB init failed %d, disabled\n", in i40e_rebuild()
10772 pf->flags &= ~I40E_FLAG_DCB_CAPABLE; in i40e_rebuild()
10781 ret = i40e_setup_pf_switch(pf, reinit, true); in i40e_rebuild()
10788 ret = i40e_aq_set_phy_int_mask(&pf->hw, in i40e_rebuild()
10793 dev_info(&pf->pdev->dev, "set phy mask fail, err %s aq_err %s\n", in i40e_rebuild()
10794 i40e_stat_str(&pf->hw, ret), in i40e_rebuild()
10795 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_rebuild()
10804 if (vsi->uplink_seid != pf->mac_seid) { in i40e_rebuild()
10805 dev_dbg(&pf->pdev->dev, "attempting to rebuild switch\n"); in i40e_rebuild()
10808 if (!pf->veb[v]) in i40e_rebuild()
10811 if (pf->veb[v]->uplink_seid == pf->mac_seid || in i40e_rebuild()
10812 pf->veb[v]->uplink_seid == 0) { in i40e_rebuild()
10813 ret = i40e_reconstitute_veb(pf->veb[v]); in i40e_rebuild()
10824 if (pf->veb[v]->uplink_seid == pf->mac_seid) { in i40e_rebuild()
10825 dev_info(&pf->pdev->dev, in i40e_rebuild()
10828 vsi->uplink_seid = pf->mac_seid; in i40e_rebuild()
10830 } else if (pf->veb[v]->uplink_seid == 0) { in i40e_rebuild()
10831 dev_info(&pf->pdev->dev, in i40e_rebuild()
10839 if (vsi->uplink_seid == pf->mac_seid) { in i40e_rebuild()
10840 dev_dbg(&pf->pdev->dev, "attempting to rebuild PF VSI\n"); in i40e_rebuild()
10844 dev_info(&pf->pdev->dev, in i40e_rebuild()
10893 if (pf->hw_features & I40E_HW_RESTART_AUTONEG) { in i40e_rebuild()
10895 ret = i40e_aq_set_link_restart_an(&pf->hw, true, NULL); in i40e_rebuild()
10897 dev_info(&pf->pdev->dev, "link restart failed, err %s aq_err %s\n", in i40e_rebuild()
10898 i40e_stat_str(&pf->hw, ret), in i40e_rebuild()
10899 i40e_aq_str(&pf->hw, in i40e_rebuild()
10900 pf->hw.aq.asq_last_status)); in i40e_rebuild()
10903 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_rebuild()
10904 ret = i40e_setup_misc_vector(pf); in i40e_rebuild()
10912 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, in i40e_rebuild()
10913 pf->main_vsi_seid); in i40e_rebuild()
10916 i40e_pf_unquiesce_all_vsi(pf); in i40e_rebuild()
10923 ret = i40e_set_promiscuous(pf, pf->cur_promisc); in i40e_rebuild()
10925 dev_warn(&pf->pdev->dev, in i40e_rebuild()
10927 pf->cur_promisc ? "on" : "off", in i40e_rebuild()
10928 i40e_stat_str(&pf->hw, ret), in i40e_rebuild()
10929 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_rebuild()
10931 i40e_reset_all_vfs(pf, true); in i40e_rebuild()
10934 i40e_send_version(pf); in i40e_rebuild()
10943 clear_bit(__I40E_RESET_FAILED, pf->state); in i40e_rebuild()
10945 clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state); in i40e_rebuild()
10946 clear_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state); in i40e_rebuild()
10956 static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit, in i40e_reset_and_rebuild() argument
10961 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_reset_and_rebuild()
10967 ret = i40e_reset(pf); in i40e_reset_and_rebuild()
10969 i40e_rebuild(pf, reinit, lock_acquired); in i40e_reset_and_rebuild()
10981 static void i40e_handle_reset_warning(struct i40e_pf *pf, bool lock_acquired) in i40e_handle_reset_warning() argument
10983 i40e_prep_for_reset(pf); in i40e_handle_reset_warning()
10984 i40e_reset_and_rebuild(pf, false, lock_acquired); in i40e_handle_reset_warning()
10993 static void i40e_handle_mdd_event(struct i40e_pf *pf) in i40e_handle_mdd_event() argument
10995 struct i40e_hw *hw = &pf->hw; in i40e_handle_mdd_event()
11001 if (!test_bit(__I40E_MDD_EVENT_PENDING, pf->state)) in i40e_handle_mdd_event()
11015 pf->hw.func_caps.base_queue; in i40e_handle_mdd_event()
11016 if (netif_msg_tx_err(pf)) in i40e_handle_mdd_event()
11017 …dev_info(&pf->pdev->dev, "Malicious Driver Detection event 0x%02x on TX queue %d PF number 0x%02x … in i40e_handle_mdd_event()
11030 pf->hw.func_caps.base_queue; in i40e_handle_mdd_event()
11031 if (netif_msg_rx_err(pf)) in i40e_handle_mdd_event()
11032 …dev_info(&pf->pdev->dev, "Malicious Driver Detection event 0x%02x on RX queue %d of function 0x%02… in i40e_handle_mdd_event()
11042 dev_dbg(&pf->pdev->dev, "TX driver issue detected on PF\n"); in i40e_handle_mdd_event()
11047 dev_dbg(&pf->pdev->dev, "RX driver issue detected on PF\n"); in i40e_handle_mdd_event()
11052 for (i = 0; i < pf->num_alloc_vfs && mdd_detected; i++) { in i40e_handle_mdd_event()
11053 vf = &(pf->vf[i]); in i40e_handle_mdd_event()
11058 dev_info(&pf->pdev->dev, "TX driver issue detected on VF %d\n", in i40e_handle_mdd_event()
11060 dev_info(&pf->pdev->dev, in i40e_handle_mdd_event()
11069 dev_info(&pf->pdev->dev, "RX driver issue detected on VF %d\n", in i40e_handle_mdd_event()
11071 dev_info(&pf->pdev->dev, in i40e_handle_mdd_event()
11078 clear_bit(__I40E_MDD_EVENT_PENDING, pf->state); in i40e_handle_mdd_event()
11091 struct i40e_pf *pf = container_of(work, in i40e_service_task() local
11097 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) || in i40e_service_task()
11098 test_bit(__I40E_SUSPENDED, pf->state)) in i40e_service_task()
11101 if (test_and_set_bit(__I40E_SERVICE_SCHED, pf->state)) in i40e_service_task()
11104 if (!test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_service_task()
11105 i40e_detect_recover_hung(pf->vsi[pf->lan_vsi]); in i40e_service_task()
11106 i40e_sync_filters_subtask(pf); in i40e_service_task()
11107 i40e_reset_subtask(pf); in i40e_service_task()
11108 i40e_handle_mdd_event(pf); in i40e_service_task()
11109 i40e_vc_process_vflr_event(pf); in i40e_service_task()
11110 i40e_watchdog_subtask(pf); in i40e_service_task()
11111 i40e_fdir_reinit_subtask(pf); in i40e_service_task()
11112 if (test_and_clear_bit(__I40E_CLIENT_RESET, pf->state)) { in i40e_service_task()
11114 i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], in i40e_service_task()
11117 i40e_client_subtask(pf); in i40e_service_task()
11119 pf->state)) in i40e_service_task()
11121 pf->vsi[pf->lan_vsi]); in i40e_service_task()
11123 i40e_sync_filters_subtask(pf); in i40e_service_task()
11125 i40e_reset_subtask(pf); in i40e_service_task()
11128 i40e_clean_adminq_subtask(pf); in i40e_service_task()
11132 clear_bit(__I40E_SERVICE_SCHED, pf->state); in i40e_service_task()
11138 if (time_after(jiffies, (start_time + pf->service_timer_period)) || in i40e_service_task()
11139 test_bit(__I40E_ADMINQ_EVENT_PENDING, pf->state) || in i40e_service_task()
11140 test_bit(__I40E_MDD_EVENT_PENDING, pf->state) || in i40e_service_task()
11141 test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_service_task()
11142 i40e_service_event_schedule(pf); in i40e_service_task()
11151 struct i40e_pf *pf = from_timer(pf, t, service_timer); in i40e_service_timer() local
11153 mod_timer(&pf->service_timer, in i40e_service_timer()
11154 round_jiffies(jiffies + pf->service_timer_period)); in i40e_service_timer()
11155 i40e_service_event_schedule(pf); in i40e_service_timer()
11164 struct i40e_pf *pf = vsi->back; in i40e_set_num_rings_in_vsi() local
11168 vsi->alloc_queue_pairs = pf->num_lan_qps; in i40e_set_num_rings_in_vsi()
11175 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_set_num_rings_in_vsi()
11176 vsi->num_q_vectors = pf->num_lan_msix; in i40e_set_num_rings_in_vsi()
11188 vsi->num_q_vectors = pf->num_fdsb_msix; in i40e_set_num_rings_in_vsi()
11192 vsi->alloc_queue_pairs = pf->num_vmdq_qps; in i40e_set_num_rings_in_vsi()
11199 vsi->num_q_vectors = pf->num_vmdq_msix; in i40e_set_num_rings_in_vsi()
11203 vsi->alloc_queue_pairs = pf->num_vf_qps; in i40e_set_num_rings_in_vsi()
11276 static int i40e_vsi_mem_alloc(struct i40e_pf *pf, enum i40e_vsi_type type) in i40e_vsi_mem_alloc() argument
11284 mutex_lock(&pf->switch_mutex); in i40e_vsi_mem_alloc()
11292 i = pf->next_vsi; in i40e_vsi_mem_alloc()
11293 while (i < pf->num_alloc_vsi && pf->vsi[i]) in i40e_vsi_mem_alloc()
11295 if (i >= pf->num_alloc_vsi) { in i40e_vsi_mem_alloc()
11297 while (i < pf->next_vsi && pf->vsi[i]) in i40e_vsi_mem_alloc()
11301 if (i < pf->num_alloc_vsi && !pf->vsi[i]) { in i40e_vsi_mem_alloc()
11307 pf->next_vsi = ++i; in i40e_vsi_mem_alloc()
11315 vsi->back = pf; in i40e_vsi_mem_alloc()
11321 pf->rss_table_size : 64; in i40e_vsi_mem_alloc()
11328 vsi->af_xdp_zc_qps = bitmap_zalloc(pf->num_lan_qps, GFP_KERNEL); in i40e_vsi_mem_alloc()
11346 pf->vsi[vsi_idx] = vsi; in i40e_vsi_mem_alloc()
11352 pf->next_vsi = i - 1; in i40e_vsi_mem_alloc()
11355 mutex_unlock(&pf->switch_mutex); in i40e_vsi_mem_alloc()
11403 struct i40e_pf *pf; in i40e_vsi_clear() local
11410 pf = vsi->back; in i40e_vsi_clear()
11412 mutex_lock(&pf->switch_mutex); in i40e_vsi_clear()
11413 if (!pf->vsi[vsi->idx]) { in i40e_vsi_clear()
11414 dev_err(&pf->pdev->dev, "pf->vsi[%d] is NULL, just free vsi[%d](type %d)\n", in i40e_vsi_clear()
11419 if (pf->vsi[vsi->idx] != vsi) { in i40e_vsi_clear()
11420 dev_err(&pf->pdev->dev, in i40e_vsi_clear()
11422 pf->vsi[vsi->idx]->idx, in i40e_vsi_clear()
11423 pf->vsi[vsi->idx]->type, in i40e_vsi_clear()
11429 i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx); in i40e_vsi_clear()
11430 i40e_put_lump(pf->irq_pile, vsi->base_vector, vsi->idx); in i40e_vsi_clear()
11436 pf->vsi[vsi->idx] = NULL; in i40e_vsi_clear()
11437 if (vsi->idx < pf->next_vsi) in i40e_vsi_clear()
11438 pf->next_vsi = vsi->idx; in i40e_vsi_clear()
11441 mutex_unlock(&pf->switch_mutex); in i40e_vsi_clear()
11474 struct i40e_pf *pf = vsi->back; in i40e_alloc_rings() local
11489 ring->dev = &pf->pdev->dev; in i40e_alloc_rings()
11495 ring->itr_setting = pf->tx_itr_default; in i40e_alloc_rings()
11506 ring->dev = &pf->pdev->dev; in i40e_alloc_rings()
11513 ring->itr_setting = pf->tx_itr_default; in i40e_alloc_rings()
11522 ring->dev = &pf->pdev->dev; in i40e_alloc_rings()
11526 ring->itr_setting = pf->rx_itr_default; in i40e_alloc_rings()
11544 static int i40e_reserve_msix_vectors(struct i40e_pf *pf, int vectors) in i40e_reserve_msix_vectors() argument
11546 vectors = pci_enable_msix_range(pf->pdev, pf->msix_entries, in i40e_reserve_msix_vectors()
11549 dev_info(&pf->pdev->dev, in i40e_reserve_msix_vectors()
11565 static int i40e_init_msix(struct i40e_pf *pf) in i40e_init_msix() argument
11567 struct i40e_hw *hw = &pf->hw; in i40e_init_msix()
11574 if (!(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_init_msix()
11609 pf->num_lan_msix = min_t(int, cpus, vectors_left / 2); in i40e_init_msix()
11610 vectors_left -= pf->num_lan_msix; in i40e_init_msix()
11613 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_init_msix()
11615 pf->num_fdsb_msix = 1; in i40e_init_msix()
11619 pf->num_fdsb_msix = 0; in i40e_init_msix()
11624 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_init_msix()
11625 iwarp_requested = pf->num_iwarp_msix; in i40e_init_msix()
11628 pf->num_iwarp_msix = 0; in i40e_init_msix()
11629 else if (vectors_left < pf->num_iwarp_msix) in i40e_init_msix()
11630 pf->num_iwarp_msix = 1; in i40e_init_msix()
11631 v_budget += pf->num_iwarp_msix; in i40e_init_msix()
11632 vectors_left -= pf->num_iwarp_msix; in i40e_init_msix()
11636 if (pf->flags & I40E_FLAG_VMDQ_ENABLED) { in i40e_init_msix()
11638 pf->num_vmdq_msix = 0; in i40e_init_msix()
11639 pf->num_vmdq_qps = 0; in i40e_init_msix()
11642 pf->num_vmdq_vsis * pf->num_vmdq_qps; in i40e_init_msix()
11653 pf->num_vmdq_qps = 1; in i40e_init_msix()
11654 vmdq_vecs_wanted = pf->num_vmdq_vsis; in i40e_init_msix()
11659 pf->num_vmdq_msix = pf->num_vmdq_qps; in i40e_init_msix()
11675 extra_vectors = min_t(int, cpus - pf->num_lan_msix, vectors_left); in i40e_init_msix()
11676 pf->num_lan_msix += extra_vectors; in i40e_init_msix()
11682 v_budget += pf->num_lan_msix; in i40e_init_msix()
11683 pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry), in i40e_init_msix()
11685 if (!pf->msix_entries) in i40e_init_msix()
11689 pf->msix_entries[i].entry = i; in i40e_init_msix()
11690 v_actual = i40e_reserve_msix_vectors(pf, v_budget); in i40e_init_msix()
11693 pf->flags &= ~I40E_FLAG_MSIX_ENABLED; in i40e_init_msix()
11694 kfree(pf->msix_entries); in i40e_init_msix()
11695 pf->msix_entries = NULL; in i40e_init_msix()
11696 pci_disable_msix(pf->pdev); in i40e_init_msix()
11701 pf->num_vmdq_vsis = 0; in i40e_init_msix()
11702 pf->num_vmdq_qps = 0; in i40e_init_msix()
11703 pf->num_lan_qps = 1; in i40e_init_msix()
11704 pf->num_lan_msix = 1; in i40e_init_msix()
11714 dev_info(&pf->pdev->dev, in i40e_init_msix()
11721 pf->num_vmdq_msix = 1; /* force VMDqs to only one vector */ in i40e_init_msix()
11722 pf->num_vmdq_vsis = 1; in i40e_init_msix()
11723 pf->num_vmdq_qps = 1; in i40e_init_msix()
11728 pf->num_lan_msix = 1; in i40e_init_msix()
11731 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_init_msix()
11732 pf->num_lan_msix = 1; in i40e_init_msix()
11733 pf->num_iwarp_msix = 1; in i40e_init_msix()
11735 pf->num_lan_msix = 2; in i40e_init_msix()
11739 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_init_msix()
11740 pf->num_iwarp_msix = min_t(int, (vec / 3), in i40e_init_msix()
11742 pf->num_vmdq_vsis = min_t(int, (vec / 3), in i40e_init_msix()
11745 pf->num_vmdq_vsis = min_t(int, (vec / 2), in i40e_init_msix()
11748 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_init_msix()
11749 pf->num_fdsb_msix = 1; in i40e_init_msix()
11752 pf->num_lan_msix = min_t(int, in i40e_init_msix()
11753 (vec - (pf->num_iwarp_msix + pf->num_vmdq_vsis)), in i40e_init_msix()
11754 pf->num_lan_msix); in i40e_init_msix()
11755 pf->num_lan_qps = pf->num_lan_msix; in i40e_init_msix()
11760 if ((pf->flags & I40E_FLAG_FD_SB_ENABLED) && in i40e_init_msix()
11761 (pf->num_fdsb_msix == 0)) { in i40e_init_msix()
11762 dev_info(&pf->pdev->dev, "Sideband Flowdir disabled, not enough MSI-X vectors\n"); in i40e_init_msix()
11763 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; in i40e_init_msix()
11764 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_init_msix()
11766 if ((pf->flags & I40E_FLAG_VMDQ_ENABLED) && in i40e_init_msix()
11767 (pf->num_vmdq_msix == 0)) { in i40e_init_msix()
11768 dev_info(&pf->pdev->dev, "VMDq disabled, not enough MSI-X vectors\n"); in i40e_init_msix()
11769 pf->flags &= ~I40E_FLAG_VMDQ_ENABLED; in i40e_init_msix()
11772 if ((pf->flags & I40E_FLAG_IWARP_ENABLED) && in i40e_init_msix()
11773 (pf->num_iwarp_msix == 0)) { in i40e_init_msix()
11774 dev_info(&pf->pdev->dev, "IWARP disabled, not enough MSI-X vectors\n"); in i40e_init_msix()
11775 pf->flags &= ~I40E_FLAG_IWARP_ENABLED; in i40e_init_msix()
11777 i40e_debug(&pf->hw, I40E_DEBUG_INIT, in i40e_init_msix()
11779 pf->num_lan_msix, in i40e_init_msix()
11780 pf->num_vmdq_msix * pf->num_vmdq_vsis, in i40e_init_msix()
11781 pf->num_fdsb_msix, in i40e_init_msix()
11782 pf->num_iwarp_msix); in i40e_init_msix()
11826 struct i40e_pf *pf = vsi->back; in i40e_vsi_alloc_q_vectors() local
11830 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_vsi_alloc_q_vectors()
11832 else if (vsi == pf->vsi[pf->lan_vsi]) in i40e_vsi_alloc_q_vectors()
11856 static int i40e_init_interrupt_scheme(struct i40e_pf *pf) in i40e_init_interrupt_scheme() argument
11861 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_init_interrupt_scheme()
11862 vectors = i40e_init_msix(pf); in i40e_init_interrupt_scheme()
11864 pf->flags &= ~(I40E_FLAG_MSIX_ENABLED | in i40e_init_interrupt_scheme()
11873 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_init_interrupt_scheme()
11876 i40e_determine_queue_usage(pf); in i40e_init_interrupt_scheme()
11880 if (!(pf->flags & I40E_FLAG_MSIX_ENABLED) && in i40e_init_interrupt_scheme()
11881 (pf->flags & I40E_FLAG_MSI_ENABLED)) { in i40e_init_interrupt_scheme()
11882 dev_info(&pf->pdev->dev, "MSI-X not available, trying MSI\n"); in i40e_init_interrupt_scheme()
11883 vectors = pci_enable_msi(pf->pdev); in i40e_init_interrupt_scheme()
11885 dev_info(&pf->pdev->dev, "MSI init failed - %d\n", in i40e_init_interrupt_scheme()
11887 pf->flags &= ~I40E_FLAG_MSI_ENABLED; in i40e_init_interrupt_scheme()
11892 if (!(pf->flags & (I40E_FLAG_MSIX_ENABLED | I40E_FLAG_MSI_ENABLED))) in i40e_init_interrupt_scheme()
11893 dev_info(&pf->pdev->dev, "MSI-X and MSI not available, falling back to Legacy IRQ\n"); in i40e_init_interrupt_scheme()
11897 pf->irq_pile = kzalloc(size, GFP_KERNEL); in i40e_init_interrupt_scheme()
11898 if (!pf->irq_pile) in i40e_init_interrupt_scheme()
11901 pf->irq_pile->num_entries = vectors; in i40e_init_interrupt_scheme()
11904 (void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1); in i40e_init_interrupt_scheme()
11917 static int i40e_restore_interrupt_scheme(struct i40e_pf *pf) in i40e_restore_interrupt_scheme() argument
11925 pf->flags |= (I40E_FLAG_MSIX_ENABLED | I40E_FLAG_MSI_ENABLED); in i40e_restore_interrupt_scheme()
11927 err = i40e_init_interrupt_scheme(pf); in i40e_restore_interrupt_scheme()
11934 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_restore_interrupt_scheme()
11935 if (pf->vsi[i]) { in i40e_restore_interrupt_scheme()
11936 err = i40e_vsi_alloc_q_vectors(pf->vsi[i]); in i40e_restore_interrupt_scheme()
11939 i40e_vsi_map_rings_to_vectors(pf->vsi[i]); in i40e_restore_interrupt_scheme()
11943 err = i40e_setup_misc_vector(pf); in i40e_restore_interrupt_scheme()
11947 if (pf->flags & I40E_FLAG_IWARP_ENABLED) in i40e_restore_interrupt_scheme()
11948 i40e_client_update_msix_info(pf); in i40e_restore_interrupt_scheme()
11954 if (pf->vsi[i]) in i40e_restore_interrupt_scheme()
11955 i40e_vsi_free_q_vectors(pf->vsi[i]); in i40e_restore_interrupt_scheme()
11971 static int i40e_setup_misc_vector_for_recovery_mode(struct i40e_pf *pf) in i40e_setup_misc_vector_for_recovery_mode() argument
11975 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_setup_misc_vector_for_recovery_mode()
11976 err = i40e_setup_misc_vector(pf); in i40e_setup_misc_vector_for_recovery_mode()
11979 dev_info(&pf->pdev->dev, in i40e_setup_misc_vector_for_recovery_mode()
11985 u32 flags = pf->flags & I40E_FLAG_MSI_ENABLED ? 0 : IRQF_SHARED; in i40e_setup_misc_vector_for_recovery_mode()
11987 err = request_irq(pf->pdev->irq, i40e_intr, flags, in i40e_setup_misc_vector_for_recovery_mode()
11988 pf->int_name, pf); in i40e_setup_misc_vector_for_recovery_mode()
11991 dev_info(&pf->pdev->dev, in i40e_setup_misc_vector_for_recovery_mode()
11996 i40e_enable_misc_int_causes(pf); in i40e_setup_misc_vector_for_recovery_mode()
11997 i40e_irq_dynamic_enable_icr0(pf); in i40e_setup_misc_vector_for_recovery_mode()
12011 static int i40e_setup_misc_vector(struct i40e_pf *pf) in i40e_setup_misc_vector() argument
12013 struct i40e_hw *hw = &pf->hw; in i40e_setup_misc_vector()
12017 if (!test_and_set_bit(__I40E_MISC_IRQ_REQUESTED, pf->state)) { in i40e_setup_misc_vector()
12018 err = request_irq(pf->msix_entries[0].vector, in i40e_setup_misc_vector()
12019 i40e_intr, 0, pf->int_name, pf); in i40e_setup_misc_vector()
12021 clear_bit(__I40E_MISC_IRQ_REQUESTED, pf->state); in i40e_setup_misc_vector()
12022 dev_info(&pf->pdev->dev, in i40e_setup_misc_vector()
12024 pf->int_name, err); in i40e_setup_misc_vector()
12029 i40e_enable_misc_int_causes(pf); in i40e_setup_misc_vector()
12037 i40e_irq_dynamic_enable_icr0(pf); in i40e_setup_misc_vector()
12054 struct i40e_pf *pf = vsi->back; in i40e_get_rss_aq() local
12055 struct i40e_hw *hw = &pf->hw; in i40e_get_rss_aq()
12062 dev_info(&pf->pdev->dev, in i40e_get_rss_aq()
12064 i40e_stat_str(&pf->hw, ret), in i40e_get_rss_aq()
12065 i40e_aq_str(&pf->hw, in i40e_get_rss_aq()
12066 pf->hw.aq.asq_last_status)); in i40e_get_rss_aq()
12076 dev_info(&pf->pdev->dev, in i40e_get_rss_aq()
12078 i40e_stat_str(&pf->hw, ret), in i40e_get_rss_aq()
12079 i40e_aq_str(&pf->hw, in i40e_get_rss_aq()
12080 pf->hw.aq.asq_last_status)); in i40e_get_rss_aq()
12100 struct i40e_pf *pf = vsi->back; in i40e_config_rss_reg() local
12101 struct i40e_hw *hw = &pf->hw; in i40e_config_rss_reg()
12116 dev_err(&pf->pdev->dev, "Cannot set RSS seed - invalid VSI type\n"); in i40e_config_rss_reg()
12134 dev_err(&pf->pdev->dev, "Cannot set RSS LUT - invalid VSI type\n"); in i40e_config_rss_reg()
12154 struct i40e_pf *pf = vsi->back; in i40e_get_rss_reg() local
12155 struct i40e_hw *hw = &pf->hw; in i40e_get_rss_reg()
12187 struct i40e_pf *pf = vsi->back; in i40e_config_rss() local
12189 if (pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) in i40e_config_rss()
12206 struct i40e_pf *pf = vsi->back; in i40e_get_rss() local
12208 if (pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) in i40e_get_rss()
12221 void i40e_fill_rss_lut(struct i40e_pf *pf, u8 *lut, in i40e_fill_rss_lut() argument
12234 static int i40e_pf_config_rss(struct i40e_pf *pf) in i40e_pf_config_rss() argument
12236 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_pf_config_rss()
12239 struct i40e_hw *hw = &pf->hw; in i40e_pf_config_rss()
12247 hena |= i40e_pf_get_default_rss_hena(pf); in i40e_pf_config_rss()
12254 reg_val = (pf->rss_table_size == 512) ? in i40e_pf_config_rss()
12269 vsi->rss_size = min_t(int, pf->alloc_rss_size, qcount); in i40e_pf_config_rss()
12282 i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size); in i40e_pf_config_rss()
12306 int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count) in i40e_reconfig_rss_queues() argument
12308 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; in i40e_reconfig_rss_queues()
12311 if (!(pf->flags & I40E_FLAG_RSS_ENABLED)) in i40e_reconfig_rss_queues()
12315 new_rss_size = min_t(int, queue_count, pf->rss_size_max); in i40e_reconfig_rss_queues()
12321 i40e_prep_for_reset(pf); in i40e_reconfig_rss_queues()
12322 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_reconfig_rss_queues()
12323 return pf->alloc_rss_size; in i40e_reconfig_rss_queues()
12325 pf->alloc_rss_size = new_rss_size; in i40e_reconfig_rss_queues()
12327 i40e_reset_and_rebuild(pf, true, true); in i40e_reconfig_rss_queues()
12334 dev_dbg(&pf->pdev->dev, in i40e_reconfig_rss_queues()
12340 vsi->rss_size = min_t(int, pf->alloc_rss_size, qcount); in i40e_reconfig_rss_queues()
12342 i40e_pf_config_rss(pf); in i40e_reconfig_rss_queues()
12344 dev_info(&pf->pdev->dev, "User requested queue count/HW max RSS count: %d/%d\n", in i40e_reconfig_rss_queues()
12345 vsi->req_queue_pairs, pf->rss_size_max); in i40e_reconfig_rss_queues()
12346 return pf->alloc_rss_size; in i40e_reconfig_rss_queues()
12353 i40e_status i40e_get_partition_bw_setting(struct i40e_pf *pf) in i40e_get_partition_bw_setting() argument
12359 status = i40e_read_bw_from_alt_ram(&pf->hw, &max_bw, &min_bw, in i40e_get_partition_bw_setting()
12364 pf->min_bw = min_bw; in i40e_get_partition_bw_setting()
12366 pf->max_bw = max_bw; in i40e_get_partition_bw_setting()
12376 i40e_status i40e_set_partition_bw_setting(struct i40e_pf *pf) in i40e_set_partition_bw_setting() argument
12384 bw_data.pf_valid_bits = cpu_to_le16(BIT(pf->hw.pf_id)); in i40e_set_partition_bw_setting()
12385 bw_data.max_bw[pf->hw.pf_id] = pf->max_bw & I40E_ALT_BW_VALUE_MASK; in i40e_set_partition_bw_setting()
12386 bw_data.min_bw[pf->hw.pf_id] = pf->min_bw & I40E_ALT_BW_VALUE_MASK; in i40e_set_partition_bw_setting()
12389 status = i40e_aq_configure_partition_bw(&pf->hw, &bw_data, NULL); in i40e_set_partition_bw_setting()
12398 i40e_status i40e_commit_partition_bw_setting(struct i40e_pf *pf) in i40e_commit_partition_bw_setting() argument
12405 if (pf->hw.partition_id != 1) { in i40e_commit_partition_bw_setting()
12406 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12408 pf->hw.partition_id); in i40e_commit_partition_bw_setting()
12414 ret = i40e_acquire_nvm(&pf->hw, I40E_RESOURCE_READ); in i40e_commit_partition_bw_setting()
12415 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12417 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12419 i40e_stat_str(&pf->hw, ret), in i40e_commit_partition_bw_setting()
12420 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12425 ret = i40e_aq_read_nvm(&pf->hw, in i40e_commit_partition_bw_setting()
12432 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12433 i40e_release_nvm(&pf->hw); in i40e_commit_partition_bw_setting()
12435 dev_info(&pf->pdev->dev, "NVM read error, err %s aq_err %s\n", in i40e_commit_partition_bw_setting()
12436 i40e_stat_str(&pf->hw, ret), in i40e_commit_partition_bw_setting()
12437 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12445 ret = i40e_acquire_nvm(&pf->hw, I40E_RESOURCE_WRITE); in i40e_commit_partition_bw_setting()
12446 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12448 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12450 i40e_stat_str(&pf->hw, ret), in i40e_commit_partition_bw_setting()
12451 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12458 ret = i40e_aq_update_nvm(&pf->hw, in i40e_commit_partition_bw_setting()
12465 last_aq_status = pf->hw.aq.asq_last_status; in i40e_commit_partition_bw_setting()
12466 i40e_release_nvm(&pf->hw); in i40e_commit_partition_bw_setting()
12468 dev_info(&pf->pdev->dev, in i40e_commit_partition_bw_setting()
12470 i40e_stat_str(&pf->hw, ret), in i40e_commit_partition_bw_setting()
12471 i40e_aq_str(&pf->hw, last_aq_status)); in i40e_commit_partition_bw_setting()
12482 static bool i40e_is_total_port_shutdown_enabled(struct i40e_pf *pf) in i40e_is_total_port_shutdown_enabled() argument
12497 read_status = i40e_read_nvm_word(&pf->hw, in i40e_is_total_port_shutdown_enabled()
12502 read_status = i40e_read_nvm_word(&pf->hw, in i40e_is_total_port_shutdown_enabled()
12509 read_status = i40e_read_nvm_module_data(&pf->hw, in i40e_is_total_port_shutdown_enabled()
12517 link_behavior >>= (pf->hw.port * I40E_LINK_BEHAVIOR_PORT_BIT_LENGTH); in i40e_is_total_port_shutdown_enabled()
12523 dev_warn(&pf->pdev->dev, in i40e_is_total_port_shutdown_enabled()
12525 i40e_stat_str(&pf->hw, read_status)); in i40e_is_total_port_shutdown_enabled()
12537 static int i40e_sw_init(struct i40e_pf *pf) in i40e_sw_init() argument
12544 pf->flags = I40E_FLAG_RX_CSUM_ENABLED | in i40e_sw_init()
12549 pf->rx_itr_default = I40E_ITR_RX_DEF; in i40e_sw_init()
12550 pf->tx_itr_default = I40E_ITR_TX_DEF; in i40e_sw_init()
12555 pf->rss_size_max = BIT(pf->hw.func_caps.rss_table_entry_width); in i40e_sw_init()
12556 pf->alloc_rss_size = 1; in i40e_sw_init()
12557 pf->rss_table_size = pf->hw.func_caps.rss_table_size; in i40e_sw_init()
12558 pf->rss_size_max = min_t(int, pf->rss_size_max, in i40e_sw_init()
12559 pf->hw.func_caps.num_tx_qp); in i40e_sw_init()
12563 pf->rss_size_max = min_t(int, pf->rss_size_max, pow); in i40e_sw_init()
12565 if (pf->hw.func_caps.rss) { in i40e_sw_init()
12566 pf->flags |= I40E_FLAG_RSS_ENABLED; in i40e_sw_init()
12567 pf->alloc_rss_size = min_t(int, pf->rss_size_max, in i40e_sw_init()
12572 if (pf->hw.func_caps.npar_enable || pf->hw.func_caps.flex10_enable) { in i40e_sw_init()
12573 pf->flags |= I40E_FLAG_MFP_ENABLED; in i40e_sw_init()
12574 dev_info(&pf->pdev->dev, "MFP mode Enabled\n"); in i40e_sw_init()
12575 if (i40e_get_partition_bw_setting(pf)) { in i40e_sw_init()
12576 dev_warn(&pf->pdev->dev, in i40e_sw_init()
12579 dev_info(&pf->pdev->dev, in i40e_sw_init()
12581 pf->min_bw, pf->max_bw); in i40e_sw_init()
12584 i40e_set_partition_bw_setting(pf); in i40e_sw_init()
12588 if ((pf->hw.func_caps.fd_filters_guaranteed > 0) || in i40e_sw_init()
12589 (pf->hw.func_caps.fd_filters_best_effort > 0)) { in i40e_sw_init()
12590 pf->flags |= I40E_FLAG_FD_ATR_ENABLED; in i40e_sw_init()
12591 pf->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE; in i40e_sw_init()
12592 if (pf->flags & I40E_FLAG_MFP_ENABLED && in i40e_sw_init()
12593 pf->hw.num_partitions > 1) in i40e_sw_init()
12594 dev_info(&pf->pdev->dev, in i40e_sw_init()
12597 pf->flags |= I40E_FLAG_FD_SB_ENABLED; in i40e_sw_init()
12598 pf->fdir_pf_filter_count = in i40e_sw_init()
12599 pf->hw.func_caps.fd_filters_guaranteed; in i40e_sw_init()
12600 pf->hw.fdir_shared_filter_count = in i40e_sw_init()
12601 pf->hw.func_caps.fd_filters_best_effort; in i40e_sw_init()
12604 if (pf->hw.mac.type == I40E_MAC_X722) { in i40e_sw_init()
12605 pf->hw_features |= (I40E_HW_RSS_AQ_CAPABLE | in i40e_sw_init()
12618 if (rd32(&pf->hw, I40E_GLQF_FDEVICTENA(1)) != in i40e_sw_init()
12620 dev_warn(&pf->pdev->dev, in i40e_sw_init()
12622 pf->hw_features &= ~I40E_HW_ATR_EVICT_CAPABLE; in i40e_sw_init()
12624 } else if ((pf->hw.aq.api_maj_ver > 1) || in i40e_sw_init()
12625 ((pf->hw.aq.api_maj_ver == 1) && in i40e_sw_init()
12626 (pf->hw.aq.api_min_ver > 4))) { in i40e_sw_init()
12628 pf->hw_features |= I40E_HW_GENEVE_OFFLOAD_CAPABLE; in i40e_sw_init()
12632 if (pf->hw_features & I40E_HW_ATR_EVICT_CAPABLE) in i40e_sw_init()
12633 pf->flags |= I40E_FLAG_HW_ATR_EVICT_ENABLED; in i40e_sw_init()
12635 if ((pf->hw.mac.type == I40E_MAC_XL710) && in i40e_sw_init()
12636 (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) || in i40e_sw_init()
12637 (pf->hw.aq.fw_maj_ver < 4))) { in i40e_sw_init()
12638 pf->hw_features |= I40E_HW_RESTART_AUTONEG; in i40e_sw_init()
12640 pf->hw_features |= I40E_HW_NO_DCB_SUPPORT; in i40e_sw_init()
12644 if ((pf->hw.mac.type == I40E_MAC_XL710) && in i40e_sw_init()
12645 (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 3)) || in i40e_sw_init()
12646 (pf->hw.aq.fw_maj_ver < 4))) in i40e_sw_init()
12647 pf->hw_features |= I40E_HW_STOP_FW_LLDP; in i40e_sw_init()
12650 if ((pf->hw.mac.type == I40E_MAC_XL710) && in i40e_sw_init()
12651 (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver >= 40)) || in i40e_sw_init()
12652 (pf->hw.aq.fw_maj_ver >= 5))) in i40e_sw_init()
12653 pf->hw_features |= I40E_HW_USE_SET_LLDP_MIB; in i40e_sw_init()
12656 if (pf->hw.mac.type == I40E_MAC_XL710 && in i40e_sw_init()
12657 pf->hw.aq.fw_maj_ver >= 6) in i40e_sw_init()
12658 pf->hw_features |= I40E_HW_PTP_L4_CAPABLE; in i40e_sw_init()
12660 if (pf->hw.func_caps.vmdq && num_online_cpus() != 1) { in i40e_sw_init()
12661 pf->num_vmdq_vsis = I40E_DEFAULT_NUM_VMDQ_VSI; in i40e_sw_init()
12662 pf->flags |= I40E_FLAG_VMDQ_ENABLED; in i40e_sw_init()
12663 pf->num_vmdq_qps = i40e_default_queues_per_vmdq(pf); in i40e_sw_init()
12666 if (pf->hw.func_caps.iwarp && num_online_cpus() != 1) { in i40e_sw_init()
12667 pf->flags |= I40E_FLAG_IWARP_ENABLED; in i40e_sw_init()
12669 pf->num_iwarp_msix = (int)num_online_cpus() + 1; in i40e_sw_init()
12676 if (pf->hw.mac.type == I40E_MAC_XL710 && in i40e_sw_init()
12677 pf->hw.func_caps.npar_enable && in i40e_sw_init()
12678 (pf->hw.flags & I40E_HW_FLAG_FW_LLDP_STOPPABLE)) in i40e_sw_init()
12679 pf->hw.flags &= ~I40E_HW_FLAG_FW_LLDP_STOPPABLE; in i40e_sw_init()
12682 if (pf->hw.func_caps.num_vfs && pf->hw.partition_id == 1) { in i40e_sw_init()
12683 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_sw_init()
12684 pf->flags |= I40E_FLAG_SRIOV_ENABLED; in i40e_sw_init()
12685 pf->num_req_vfs = min_t(int, in i40e_sw_init()
12686 pf->hw.func_caps.num_vfs, in i40e_sw_init()
12690 pf->eeprom_version = 0xDEAD; in i40e_sw_init()
12691 pf->lan_veb = I40E_NO_VEB; in i40e_sw_init()
12692 pf->lan_vsi = I40E_NO_VSI; in i40e_sw_init()
12695 pf->flags &= ~I40E_FLAG_VEB_STATS_ENABLED; in i40e_sw_init()
12699 + (sizeof(u16) * pf->hw.func_caps.num_tx_qp); in i40e_sw_init()
12700 pf->qp_pile = kzalloc(size, GFP_KERNEL); in i40e_sw_init()
12701 if (!pf->qp_pile) { in i40e_sw_init()
12705 pf->qp_pile->num_entries = pf->hw.func_caps.num_tx_qp; in i40e_sw_init()
12707 pf->tx_timeout_recovery_level = 1; in i40e_sw_init()
12709 if (pf->hw.mac.type != I40E_MAC_X722 && in i40e_sw_init()
12710 i40e_is_total_port_shutdown_enabled(pf)) { in i40e_sw_init()
12714 pf->flags |= (I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED | in i40e_sw_init()
12716 dev_info(&pf->pdev->dev, in i40e_sw_init()
12719 mutex_init(&pf->switch_mutex); in i40e_sw_init()
12732 bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features) in i40e_set_ntuple() argument
12741 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) in i40e_set_ntuple()
12746 if (pf->num_fdsb_msix > 0 && !pf->num_cloud_filters) { in i40e_set_ntuple()
12747 pf->flags |= I40E_FLAG_FD_SB_ENABLED; in i40e_set_ntuple()
12748 pf->flags &= ~I40E_FLAG_FD_SB_INACTIVE; in i40e_set_ntuple()
12752 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_set_ntuple()
12754 i40e_fdir_filter_exit(pf); in i40e_set_ntuple()
12756 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; in i40e_set_ntuple()
12757 clear_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state); in i40e_set_ntuple()
12758 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_set_ntuple()
12761 pf->fd_add_err = 0; in i40e_set_ntuple()
12762 pf->fd_atr_cnt = 0; in i40e_set_ntuple()
12764 if (test_and_clear_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state)) in i40e_set_ntuple()
12765 if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) && in i40e_set_ntuple()
12766 (I40E_DEBUG_FD & pf->hw.debug_mask)) in i40e_set_ntuple()
12767 dev_info(&pf->pdev->dev, "ATR re-enabled.\n"); in i40e_set_ntuple()
12778 struct i40e_pf *pf = vsi->back; in i40e_clear_rss_lut() local
12779 struct i40e_hw *hw = &pf->hw; in i40e_clear_rss_lut()
12790 dev_err(&pf->pdev->dev, "Cannot set RSS LUT - invalid VSI type\n"); in i40e_clear_rss_lut()
12805 struct i40e_pf *pf = vsi->back; in i40e_set_features() local
12809 i40e_pf_config_rss(pf); in i40e_set_features()
12820 (netdev->features & NETIF_F_HW_TC) && pf->num_cloud_filters) { in i40e_set_features()
12821 dev_err(&pf->pdev->dev, in i40e_set_features()
12829 need_reset = i40e_set_ntuple(pf, features); in i40e_set_features()
12832 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_set_features()
12885 struct i40e_pf *pf = np->vsi->back; in i40e_get_phys_port_id() local
12886 struct i40e_hw *hw = &pf->hw; in i40e_get_phys_port_id()
12888 if (!(pf->hw_features & I40E_HW_PORT_ID_VALID)) in i40e_get_phys_port_id()
12914 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_fdb_add() local
12917 if (!(pf->flags & I40E_FLAG_SRIOV_ENABLED)) in i40e_ndo_fdb_add()
12970 struct i40e_pf *pf = vsi->back; in i40e_ndo_bridge_setlink() local
12976 if (vsi->seid != pf->vsi[pf->lan_vsi]->seid) in i40e_ndo_bridge_setlink()
12981 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_ndo_bridge_setlink()
12982 veb = pf->veb[i]; in i40e_ndo_bridge_setlink()
13000 veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid, in i40e_ndo_bridge_setlink()
13015 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_ndo_bridge_setlink()
13017 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_ndo_bridge_setlink()
13018 i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); in i40e_ndo_bridge_setlink()
13045 struct i40e_pf *pf = vsi->back; in i40e_ndo_bridge_getlink() local
13050 if (vsi->seid != pf->vsi[pf->lan_vsi]->seid) in i40e_ndo_bridge_getlink()
13055 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_ndo_bridge_getlink()
13056 veb = pf->veb[i]; in i40e_ndo_bridge_getlink()
13134 struct i40e_pf *pf = vsi->back; in i40e_xdp_setup() local
13149 i40e_prep_for_reset(pf); in i40e_xdp_setup()
13152 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_xdp_setup()
13161 i40e_reset_and_rebuild(pf, true, true); in i40e_xdp_setup()
13190 struct i40e_pf *pf = vsi->back; in i40e_enter_busy_conf() local
13193 while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) { in i40e_enter_busy_conf()
13209 struct i40e_pf *pf = vsi->back; in i40e_exit_busy_conf() local
13211 clear_bit(__I40E_CONFIG_BUSY, pf->state); in i40e_exit_busy_conf()
13284 struct i40e_pf *pf = vsi->back; in i40e_queue_pair_toggle_rings() local
13288 ret = i40e_control_wait_tx_q(vsi->seid, pf, pf_q, in i40e_queue_pair_toggle_rings()
13291 dev_info(&pf->pdev->dev, in i40e_queue_pair_toggle_rings()
13297 i40e_control_rx_q(pf, pf_q, enable); in i40e_queue_pair_toggle_rings()
13298 ret = i40e_pf_rxq_wait(pf, pf_q, enable); in i40e_queue_pair_toggle_rings()
13300 dev_info(&pf->pdev->dev, in i40e_queue_pair_toggle_rings()
13315 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_queue_pair_toggle_rings()
13319 dev_info(&pf->pdev->dev, in i40e_queue_pair_toggle_rings()
13335 struct i40e_pf *pf = vsi->back; in i40e_queue_pair_enable_irq() local
13336 struct i40e_hw *hw = &pf->hw; in i40e_queue_pair_enable_irq()
13339 if (pf->flags & I40E_FLAG_MSIX_ENABLED) in i40e_queue_pair_enable_irq()
13342 i40e_irq_dynamic_enable_icr0(pf); in i40e_queue_pair_enable_irq()
13355 struct i40e_pf *pf = vsi->back; in i40e_queue_pair_disable_irq() local
13356 struct i40e_hw *hw = &pf->hw; in i40e_queue_pair_disable_irq()
13364 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_queue_pair_disable_irq()
13369 synchronize_irq(pf->msix_entries[intpf].vector); in i40e_queue_pair_disable_irq()
13375 synchronize_irq(pf->pdev->irq); in i40e_queue_pair_disable_irq()
13509 struct i40e_pf *pf = vsi->back; in i40e_config_netdev() local
13510 struct i40e_hw *hw = &pf->hw; in i40e_config_netdev()
13548 if (!(pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE)) in i40e_config_netdev()
13551 netdev->udp_tunnel_nic_info = &pf->udp_tunnel_nic; in i40e_config_netdev()
13584 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) in i40e_config_netdev()
13595 SET_NETDEV_DEV(netdev, &pf->pdev->dev); in i40e_config_netdev()
13619 pf->vsi[pf->lan_vsi]->netdev->name); in i40e_config_netdev()
13691 struct i40e_pf *pf = vsi->back; in i40e_is_vsi_uplink_mode_veb() local
13697 veb = pf->veb[vsi->veb_idx]; in i40e_is_vsi_uplink_mode_veb()
13699 dev_info(&pf->pdev->dev, in i40e_is_vsi_uplink_mode_veb()
13726 struct i40e_pf *pf = vsi->back; in i40e_add_vsi() local
13727 struct i40e_hw *hw = &pf->hw; in i40e_add_vsi()
13744 ctxt.seid = pf->main_vsi_seid; in i40e_add_vsi()
13745 ctxt.pf_num = pf->hw.pf_id; in i40e_add_vsi()
13747 ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); in i40e_add_vsi()
13750 dev_info(&pf->pdev->dev, in i40e_add_vsi()
13752 i40e_stat_str(&pf->hw, ret), in i40e_add_vsi()
13753 i40e_aq_str(&pf->hw, in i40e_add_vsi()
13754 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
13763 enabled_tc = i40e_pf_get_tc_map(pf); in i40e_add_vsi()
13769 if (pf->flags & I40E_FLAG_SOURCE_PRUNING_DISABLED) { in i40e_add_vsi()
13771 ctxt.seid = pf->main_vsi_seid; in i40e_add_vsi()
13772 ctxt.pf_num = pf->hw.pf_id; in i40e_add_vsi()
13780 dev_info(&pf->pdev->dev, in i40e_add_vsi()
13782 i40e_stat_str(&pf->hw, ret), in i40e_add_vsi()
13783 i40e_aq_str(&pf->hw, in i40e_add_vsi()
13784 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
13791 if ((pf->flags & I40E_FLAG_MFP_ENABLED) && in i40e_add_vsi()
13792 !(pf->hw.func_caps.iscsi)) { /* NIC type PF */ in i40e_add_vsi()
13794 ctxt.seid = pf->main_vsi_seid; in i40e_add_vsi()
13795 ctxt.pf_num = pf->hw.pf_id; in i40e_add_vsi()
13800 dev_info(&pf->pdev->dev, in i40e_add_vsi()
13802 i40e_stat_str(&pf->hw, ret), in i40e_add_vsi()
13803 i40e_aq_str(&pf->hw, in i40e_add_vsi()
13804 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
13823 dev_info(&pf->pdev->dev, in i40e_add_vsi()
13826 i40e_stat_str(&pf->hw, ret), in i40e_add_vsi()
13827 i40e_aq_str(&pf->hw, in i40e_add_vsi()
13828 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
13839 if ((pf->flags & I40E_FLAG_VEB_MODE_ENABLED) && in i40e_add_vsi()
13897 if (pf->vf[vsi->vf_id].spoofchk) { in i40e_add_vsi()
13921 i40e_stat_str(&pf->hw, ret), in i40e_add_vsi()
13922 i40e_aq_str(&pf->hw, in i40e_add_vsi()
13923 pf->hw.aq.asq_last_status)); in i40e_add_vsi()
13945 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_add_vsi()
13951 dev_info(&pf->pdev->dev, in i40e_add_vsi()
13953 i40e_stat_str(&pf->hw, ret), in i40e_add_vsi()
13954 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_vsi()
13974 struct i40e_pf *pf; in i40e_vsi_release() local
13978 pf = vsi->back; in i40e_vsi_release()
13982 dev_info(&pf->pdev->dev, "VSI %d has existing VEB %d\n", in i40e_vsi_release()
13986 if (vsi == pf->vsi[pf->lan_vsi] && in i40e_vsi_release()
13987 !test_bit(__I40E_DOWN, pf->state)) { in i40e_vsi_release()
13988 dev_info(&pf->pdev->dev, "Can't remove PF VSI\n"); in i40e_vsi_release()
14039 for (n = 0, i = 0; i < pf->num_alloc_vsi; i++) { in i40e_vsi_release()
14040 if (pf->vsi[i] && in i40e_vsi_release()
14041 pf->vsi[i]->uplink_seid == uplink_seid && in i40e_vsi_release()
14042 (pf->vsi[i]->flags & I40E_VSI_FLAG_VEB_OWNER) == 0) { in i40e_vsi_release()
14047 if (!pf->veb[i]) in i40e_vsi_release()
14049 if (pf->veb[i]->uplink_seid == uplink_seid) in i40e_vsi_release()
14051 if (pf->veb[i]->seid == uplink_seid) in i40e_vsi_release()
14052 veb = pf->veb[i]; in i40e_vsi_release()
14073 struct i40e_pf *pf = vsi->back; in i40e_vsi_setup_vectors() local
14076 dev_info(&pf->pdev->dev, "VSI %d has existing q_vectors\n", in i40e_vsi_setup_vectors()
14082 dev_info(&pf->pdev->dev, "VSI %d has non-zero base vector %d\n", in i40e_vsi_setup_vectors()
14089 dev_info(&pf->pdev->dev, in i40e_vsi_setup_vectors()
14099 if (!(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_vsi_setup_vectors()
14102 vsi->base_vector = i40e_get_lump(pf, pf->irq_pile, in i40e_vsi_setup_vectors()
14105 dev_info(&pf->pdev->dev, in i40e_vsi_setup_vectors()
14129 struct i40e_pf *pf; in i40e_vsi_reinit_setup() local
14136 pf = vsi->back; in i40e_vsi_reinit_setup()
14138 i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx); in i40e_vsi_reinit_setup()
14150 ret = i40e_get_lump(pf, pf->qp_pile, alloc_queue_pairs, vsi->idx); in i40e_vsi_reinit_setup()
14152 dev_info(&pf->pdev->dev, in i40e_vsi_reinit_setup()
14162 enabled_tc = pf->vsi[pf->lan_vsi]->tc_config.enabled_tc; in i40e_vsi_reinit_setup()
14163 pf->vsi[pf->lan_vsi]->tc_config.enabled_tc = 0; in i40e_vsi_reinit_setup()
14164 pf->vsi[pf->lan_vsi]->seid = pf->main_vsi_seid; in i40e_vsi_reinit_setup()
14165 i40e_vsi_config_tc(pf->vsi[pf->lan_vsi], enabled_tc); in i40e_vsi_reinit_setup()
14167 i40e_rm_default_mac_filter(vsi, pf->hw.mac.perm_addr); in i40e_vsi_reinit_setup()
14186 i40e_aq_delete_element(&pf->hw, vsi->seid, NULL); in i40e_vsi_reinit_setup()
14205 struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type, in i40e_vsi_setup() argument
14228 if (pf->veb[i] && pf->veb[i]->seid == uplink_seid) { in i40e_vsi_setup()
14229 veb = pf->veb[i]; in i40e_vsi_setup()
14234 if (!veb && uplink_seid != pf->mac_seid) { in i40e_vsi_setup()
14236 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_vsi_setup()
14237 if (pf->vsi[i] && pf->vsi[i]->seid == uplink_seid) { in i40e_vsi_setup()
14238 vsi = pf->vsi[i]; in i40e_vsi_setup()
14243 dev_info(&pf->pdev->dev, "no such uplink_seid %d\n", in i40e_vsi_setup()
14248 if (vsi->uplink_seid == pf->mac_seid) in i40e_vsi_setup()
14249 veb = i40e_veb_setup(pf, 0, pf->mac_seid, vsi->seid, in i40e_vsi_setup()
14252 veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid, in i40e_vsi_setup()
14255 if (vsi->seid != pf->vsi[pf->lan_vsi]->seid) { in i40e_vsi_setup()
14264 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_vsi_setup()
14266 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_vsi_setup()
14271 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_vsi_setup()
14272 veb = pf->veb[i]; in i40e_vsi_setup()
14275 dev_info(&pf->pdev->dev, "couldn't add VEB\n"); in i40e_vsi_setup()
14284 v_idx = i40e_vsi_mem_alloc(pf, type); in i40e_vsi_setup()
14287 vsi = pf->vsi[v_idx]; in i40e_vsi_setup()
14294 pf->lan_vsi = v_idx; in i40e_vsi_setup()
14301 ret = i40e_get_lump(pf, pf->qp_pile, alloc_queue_pairs, vsi->idx); in i40e_vsi_setup()
14303 dev_info(&pf->pdev->dev, in i40e_vsi_setup()
14356 if ((pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) && in i40e_vsi_setup()
14372 i40e_aq_delete_element(&pf->hw, vsi->seid, NULL); in i40e_vsi_setup()
14389 struct i40e_pf *pf = veb->pf; in i40e_veb_get_bw_info() local
14390 struct i40e_hw *hw = &pf->hw; in i40e_veb_get_bw_info()
14398 dev_info(&pf->pdev->dev, in i40e_veb_get_bw_info()
14400 i40e_stat_str(&pf->hw, ret), in i40e_veb_get_bw_info()
14401 i40e_aq_str(&pf->hw, hw->aq.asq_last_status)); in i40e_veb_get_bw_info()
14408 dev_info(&pf->pdev->dev, in i40e_veb_get_bw_info()
14410 i40e_stat_str(&pf->hw, ret), in i40e_veb_get_bw_info()
14411 i40e_aq_str(&pf->hw, hw->aq.asq_last_status)); in i40e_veb_get_bw_info()
14439 static int i40e_veb_mem_alloc(struct i40e_pf *pf) in i40e_veb_mem_alloc() argument
14446 mutex_lock(&pf->switch_mutex); in i40e_veb_mem_alloc()
14455 while ((i < I40E_MAX_VEB) && (pf->veb[i] != NULL)) in i40e_veb_mem_alloc()
14467 veb->pf = pf; in i40e_veb_mem_alloc()
14471 pf->veb[i] = veb; in i40e_veb_mem_alloc()
14474 mutex_unlock(&pf->switch_mutex); in i40e_veb_mem_alloc()
14487 struct i40e_pf *pf = branch->pf; in i40e_switch_branch_release() local
14494 if (!pf->veb[i]) in i40e_switch_branch_release()
14496 if (pf->veb[i]->uplink_seid == branch->seid) in i40e_switch_branch_release()
14497 i40e_switch_branch_release(pf->veb[i]); in i40e_switch_branch_release()
14505 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_switch_branch_release()
14506 if (!pf->vsi[i]) in i40e_switch_branch_release()
14508 if (pf->vsi[i]->uplink_seid == branch_seid && in i40e_switch_branch_release()
14509 (pf->vsi[i]->flags & I40E_VSI_FLAG_VEB_OWNER) == 0) { in i40e_switch_branch_release()
14510 i40e_vsi_release(pf->vsi[i]); in i40e_switch_branch_release()
14519 if (pf->veb[veb_idx]) in i40e_switch_branch_release()
14520 i40e_veb_release(pf->veb[veb_idx]); in i40e_switch_branch_release()
14532 if (veb->pf) { in i40e_veb_clear()
14533 struct i40e_pf *pf = veb->pf; in i40e_veb_clear() local
14535 mutex_lock(&pf->switch_mutex); in i40e_veb_clear()
14536 if (pf->veb[veb->idx] == veb) in i40e_veb_clear()
14537 pf->veb[veb->idx] = NULL; in i40e_veb_clear()
14538 mutex_unlock(&pf->switch_mutex); in i40e_veb_clear()
14551 struct i40e_pf *pf; in i40e_veb_release() local
14554 pf = veb->pf; in i40e_veb_release()
14557 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_veb_release()
14558 if (pf->vsi[i] && pf->vsi[i]->uplink_seid == veb->seid) { in i40e_veb_release()
14560 vsi = pf->vsi[i]; in i40e_veb_release()
14564 dev_info(&pf->pdev->dev, in i40e_veb_release()
14574 if (veb->uplink_seid == pf->mac_seid) in i40e_veb_release()
14580 vsi->uplink_seid = pf->vsi[pf->lan_vsi]->uplink_seid; in i40e_veb_release()
14581 vsi->veb_idx = pf->vsi[pf->lan_vsi]->veb_idx; in i40e_veb_release()
14584 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_veb_release()
14595 struct i40e_pf *pf = veb->pf; in i40e_add_veb() local
14596 bool enable_stats = !!(pf->flags & I40E_FLAG_VEB_STATS_ENABLED); in i40e_add_veb()
14599 ret = i40e_aq_add_veb(&pf->hw, veb->uplink_seid, vsi->seid, in i40e_add_veb()
14605 dev_info(&pf->pdev->dev, in i40e_add_veb()
14607 i40e_stat_str(&pf->hw, ret), in i40e_add_veb()
14608 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_veb()
14613 ret = i40e_aq_get_veb_parameters(&pf->hw, veb->seid, NULL, NULL, in i40e_add_veb()
14616 dev_info(&pf->pdev->dev, in i40e_add_veb()
14618 i40e_stat_str(&pf->hw, ret), in i40e_add_veb()
14619 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_veb()
14624 dev_info(&pf->pdev->dev, in i40e_add_veb()
14626 i40e_stat_str(&pf->hw, ret), in i40e_add_veb()
14627 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_add_veb()
14628 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_add_veb()
14655 struct i40e_veb *i40e_veb_setup(struct i40e_pf *pf, u16 flags, in i40e_veb_setup() argument
14666 dev_info(&pf->pdev->dev, in i40e_veb_setup()
14673 for (vsi_idx = 0; vsi_idx < pf->num_alloc_vsi; vsi_idx++) in i40e_veb_setup()
14674 if (pf->vsi[vsi_idx] && pf->vsi[vsi_idx]->seid == vsi_seid) in i40e_veb_setup()
14676 if (vsi_idx == pf->num_alloc_vsi && vsi_seid != 0) { in i40e_veb_setup()
14677 dev_info(&pf->pdev->dev, "vsi seid %d not found\n", in i40e_veb_setup()
14682 if (uplink_seid && uplink_seid != pf->mac_seid) { in i40e_veb_setup()
14684 if (pf->veb[veb_idx] && in i40e_veb_setup()
14685 pf->veb[veb_idx]->seid == uplink_seid) { in i40e_veb_setup()
14686 uplink_veb = pf->veb[veb_idx]; in i40e_veb_setup()
14691 dev_info(&pf->pdev->dev, in i40e_veb_setup()
14698 veb_idx = i40e_veb_mem_alloc(pf); in i40e_veb_setup()
14701 veb = pf->veb[veb_idx]; in i40e_veb_setup()
14708 ret = i40e_add_veb(veb, pf->vsi[vsi_idx]); in i40e_veb_setup()
14711 if (vsi_idx == pf->lan_vsi) in i40e_veb_setup()
14712 pf->lan_veb = veb->idx; in i40e_veb_setup()
14731 static void i40e_setup_pf_switch_element(struct i40e_pf *pf, in i40e_setup_pf_switch_element() argument
14741 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch_element()
14747 pf->mac_seid = seid; in i40e_setup_pf_switch_element()
14751 if (uplink_seid != pf->mac_seid) in i40e_setup_pf_switch_element()
14753 if (pf->lan_veb >= I40E_MAX_VEB) { in i40e_setup_pf_switch_element()
14758 if (pf->veb[v] && (pf->veb[v]->seid == seid)) { in i40e_setup_pf_switch_element()
14759 pf->lan_veb = v; in i40e_setup_pf_switch_element()
14763 if (pf->lan_veb >= I40E_MAX_VEB) { in i40e_setup_pf_switch_element()
14764 v = i40e_veb_mem_alloc(pf); in i40e_setup_pf_switch_element()
14767 pf->lan_veb = v; in i40e_setup_pf_switch_element()
14770 if (pf->lan_veb >= I40E_MAX_VEB) in i40e_setup_pf_switch_element()
14773 pf->veb[pf->lan_veb]->seid = seid; in i40e_setup_pf_switch_element()
14774 pf->veb[pf->lan_veb]->uplink_seid = pf->mac_seid; in i40e_setup_pf_switch_element()
14775 pf->veb[pf->lan_veb]->pf = pf; in i40e_setup_pf_switch_element()
14776 pf->veb[pf->lan_veb]->veb_idx = I40E_NO_VEB; in i40e_setup_pf_switch_element()
14784 pf->mac_seid = uplink_seid; in i40e_setup_pf_switch_element()
14785 pf->pf_seid = downlink_seid; in i40e_setup_pf_switch_element()
14786 pf->main_vsi_seid = seid; in i40e_setup_pf_switch_element()
14788 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch_element()
14790 pf->pf_seid, pf->main_vsi_seid); in i40e_setup_pf_switch_element()
14801 dev_info(&pf->pdev->dev, "unknown element type=%d seid=%d\n", in i40e_setup_pf_switch_element()
14815 int i40e_fetch_switch_configuration(struct i40e_pf *pf, bool printconfig) in i40e_fetch_switch_configuration() argument
14831 ret = i40e_aq_get_switch_config(&pf->hw, sw_config, in i40e_fetch_switch_configuration()
14835 dev_info(&pf->pdev->dev, in i40e_fetch_switch_configuration()
14837 i40e_stat_str(&pf->hw, ret), in i40e_fetch_switch_configuration()
14838 i40e_aq_str(&pf->hw, in i40e_fetch_switch_configuration()
14839 pf->hw.aq.asq_last_status)); in i40e_fetch_switch_configuration()
14848 dev_info(&pf->pdev->dev, in i40e_fetch_switch_configuration()
14856 i40e_setup_pf_switch_element(pf, ele, num_reported, in i40e_fetch_switch_configuration()
14873 static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit, bool lock_acquired) in i40e_setup_pf_switch() argument
14879 ret = i40e_fetch_switch_configuration(pf, false); in i40e_setup_pf_switch()
14881 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch()
14883 i40e_stat_str(&pf->hw, ret), in i40e_setup_pf_switch()
14884 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_setup_pf_switch()
14887 i40e_pf_reset_stats(pf); in i40e_setup_pf_switch()
14895 if ((pf->hw.pf_id == 0) && in i40e_setup_pf_switch()
14896 !(pf->flags & I40E_FLAG_TRUE_PROMISC_SUPPORT)) { in i40e_setup_pf_switch()
14898 pf->last_sw_conf_flags = flags; in i40e_setup_pf_switch()
14901 if (pf->hw.pf_id == 0) { in i40e_setup_pf_switch()
14905 ret = i40e_aq_set_switch_config(&pf->hw, flags, valid_flags, 0, in i40e_setup_pf_switch()
14907 if (ret && pf->hw.aq.asq_last_status != I40E_AQ_RC_ESRCH) { in i40e_setup_pf_switch()
14908 dev_info(&pf->pdev->dev, in i40e_setup_pf_switch()
14910 i40e_stat_str(&pf->hw, ret), in i40e_setup_pf_switch()
14911 i40e_aq_str(&pf->hw, in i40e_setup_pf_switch()
14912 pf->hw.aq.asq_last_status)); in i40e_setup_pf_switch()
14915 pf->last_sw_conf_valid_flags = valid_flags; in i40e_setup_pf_switch()
14919 if (pf->lan_vsi == I40E_NO_VSI || reinit) { in i40e_setup_pf_switch()
14926 if (pf->lan_veb < I40E_MAX_VEB && pf->veb[pf->lan_veb]) in i40e_setup_pf_switch()
14927 uplink_seid = pf->veb[pf->lan_veb]->seid; in i40e_setup_pf_switch()
14929 uplink_seid = pf->mac_seid; in i40e_setup_pf_switch()
14930 if (pf->lan_vsi == I40E_NO_VSI) in i40e_setup_pf_switch()
14931 vsi = i40e_vsi_setup(pf, I40E_VSI_MAIN, uplink_seid, 0); in i40e_setup_pf_switch()
14933 vsi = i40e_vsi_reinit_setup(pf->vsi[pf->lan_vsi]); in i40e_setup_pf_switch()
14935 dev_info(&pf->pdev->dev, "setup of MAIN VSI failed\n"); in i40e_setup_pf_switch()
14936 i40e_cloud_filter_exit(pf); in i40e_setup_pf_switch()
14937 i40e_fdir_teardown(pf); in i40e_setup_pf_switch()
14942 u8 enabled_tc = pf->vsi[pf->lan_vsi]->tc_config.enabled_tc; in i40e_setup_pf_switch()
14944 pf->vsi[pf->lan_vsi]->tc_config.enabled_tc = 0; in i40e_setup_pf_switch()
14945 pf->vsi[pf->lan_vsi]->seid = pf->main_vsi_seid; in i40e_setup_pf_switch()
14946 i40e_vsi_config_tc(pf->vsi[pf->lan_vsi], enabled_tc); in i40e_setup_pf_switch()
14948 i40e_vlan_stripping_disable(pf->vsi[pf->lan_vsi]); in i40e_setup_pf_switch()
14950 i40e_fdir_sb_setup(pf); in i40e_setup_pf_switch()
14953 ret = i40e_setup_pf_filter_control(pf); in i40e_setup_pf_switch()
14955 dev_info(&pf->pdev->dev, "setup_pf_filter_control failed: %d\n", in i40e_setup_pf_switch()
14963 if ((pf->flags & I40E_FLAG_RSS_ENABLED)) in i40e_setup_pf_switch()
14964 i40e_pf_config_rss(pf); in i40e_setup_pf_switch()
14967 i40e_link_event(pf); in i40e_setup_pf_switch()
14970 pf->fc_autoneg_status = ((pf->hw.phy.link_info.an_info & in i40e_setup_pf_switch()
14973 i40e_ptp_init(pf); in i40e_setup_pf_switch()
14979 udp_tunnel_nic_reset_ntf(pf->vsi[pf->lan_vsi]->netdev); in i40e_setup_pf_switch()
14991 static void i40e_determine_queue_usage(struct i40e_pf *pf) in i40e_determine_queue_usage() argument
14996 pf->num_lan_qps = 0; in i40e_determine_queue_usage()
15002 queues_left = pf->hw.func_caps.num_tx_qp; in i40e_determine_queue_usage()
15005 !(pf->flags & I40E_FLAG_MSIX_ENABLED)) { in i40e_determine_queue_usage()
15008 pf->alloc_rss_size = pf->num_lan_qps = 1; in i40e_determine_queue_usage()
15011 pf->flags &= ~(I40E_FLAG_RSS_ENABLED | in i40e_determine_queue_usage()
15019 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_determine_queue_usage()
15020 } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | in i40e_determine_queue_usage()
15025 pf->alloc_rss_size = pf->num_lan_qps = 1; in i40e_determine_queue_usage()
15026 queues_left -= pf->num_lan_qps; in i40e_determine_queue_usage()
15028 pf->flags &= ~(I40E_FLAG_RSS_ENABLED | in i40e_determine_queue_usage()
15034 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_determine_queue_usage()
15037 if ((pf->flags & I40E_FLAG_DCB_CAPABLE) && in i40e_determine_queue_usage()
15039 pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | in i40e_determine_queue_usage()
15041 dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); in i40e_determine_queue_usage()
15045 q_max = max_t(int, pf->rss_size_max, num_online_cpus()); in i40e_determine_queue_usage()
15046 q_max = min_t(int, q_max, pf->hw.func_caps.num_tx_qp); in i40e_determine_queue_usage()
15047 q_max = min_t(int, q_max, pf->hw.func_caps.num_msix_vectors); in i40e_determine_queue_usage()
15048 pf->num_lan_qps = q_max; in i40e_determine_queue_usage()
15050 queues_left -= pf->num_lan_qps; in i40e_determine_queue_usage()
15053 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_determine_queue_usage()
15057 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; in i40e_determine_queue_usage()
15058 pf->flags |= I40E_FLAG_FD_SB_INACTIVE; in i40e_determine_queue_usage()
15059 …dev_info(&pf->pdev->dev, "not enough queues for Flow Director. Flow Director feature is disabled\n… in i40e_determine_queue_usage()
15063 if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) && in i40e_determine_queue_usage()
15064 pf->num_vf_qps && pf->num_req_vfs && queues_left) { in i40e_determine_queue_usage()
15065 pf->num_req_vfs = min_t(int, pf->num_req_vfs, in i40e_determine_queue_usage()
15066 (queues_left / pf->num_vf_qps)); in i40e_determine_queue_usage()
15067 queues_left -= (pf->num_req_vfs * pf->num_vf_qps); in i40e_determine_queue_usage()
15070 if ((pf->flags & I40E_FLAG_VMDQ_ENABLED) && in i40e_determine_queue_usage()
15071 pf->num_vmdq_vsis && pf->num_vmdq_qps && queues_left) { in i40e_determine_queue_usage()
15072 pf->num_vmdq_vsis = min_t(int, pf->num_vmdq_vsis, in i40e_determine_queue_usage()
15073 (queues_left / pf->num_vmdq_qps)); in i40e_determine_queue_usage()
15074 queues_left -= (pf->num_vmdq_vsis * pf->num_vmdq_qps); in i40e_determine_queue_usage()
15077 pf->queues_left = queues_left; in i40e_determine_queue_usage()
15078 dev_dbg(&pf->pdev->dev, in i40e_determine_queue_usage()
15080 pf->hw.func_caps.num_tx_qp, in i40e_determine_queue_usage()
15081 !!(pf->flags & I40E_FLAG_FD_SB_ENABLED), in i40e_determine_queue_usage()
15082 pf->num_lan_qps, pf->alloc_rss_size, pf->num_req_vfs, in i40e_determine_queue_usage()
15083 pf->num_vf_qps, pf->num_vmdq_vsis, pf->num_vmdq_qps, in i40e_determine_queue_usage()
15098 static int i40e_setup_pf_filter_control(struct i40e_pf *pf) in i40e_setup_pf_filter_control() argument
15100 struct i40e_filter_control_settings *settings = &pf->filter_settings; in i40e_setup_pf_filter_control()
15105 if (pf->flags & (I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_ATR_ENABLED)) in i40e_setup_pf_filter_control()
15112 if (i40e_set_filter_control(&pf->hw, settings)) in i40e_setup_pf_filter_control()
15120 static void i40e_print_features(struct i40e_pf *pf) in i40e_print_features() argument
15122 struct i40e_hw *hw = &pf->hw; in i40e_print_features()
15132 i += scnprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs); in i40e_print_features()
15135 pf->hw.func_caps.num_vsis, in i40e_print_features()
15136 pf->vsi[pf->lan_vsi]->num_queue_pairs); in i40e_print_features()
15137 if (pf->flags & I40E_FLAG_RSS_ENABLED) in i40e_print_features()
15139 if (pf->flags & I40E_FLAG_FD_ATR_ENABLED) in i40e_print_features()
15141 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { in i40e_print_features()
15145 if (pf->flags & I40E_FLAG_DCB_CAPABLE) in i40e_print_features()
15149 if (pf->flags & I40E_FLAG_PTP) in i40e_print_features()
15151 if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED) in i40e_print_features()
15156 dev_info(&pf->pdev->dev, "%s\n", buf); in i40e_print_features()
15171 static void i40e_get_platform_mac_addr(struct pci_dev *pdev, struct i40e_pf *pf) in i40e_get_platform_mac_addr() argument
15173 if (eth_platform_get_mac_address(&pdev->dev, pf->hw.mac.addr)) in i40e_get_platform_mac_addr()
15174 i40e_get_mac_addr(&pf->hw, pf->hw.mac.addr); in i40e_get_platform_mac_addr()
15209 static bool i40e_check_recovery_mode(struct i40e_pf *pf) in i40e_check_recovery_mode() argument
15211 u32 val = rd32(&pf->hw, I40E_GL_FWSTS); in i40e_check_recovery_mode()
15214 dev_crit(&pf->pdev->dev, "Firmware recovery mode detected. Limiting functionality.\n"); in i40e_check_recovery_mode()
15215 …dev_crit(&pf->pdev->dev, "Refer to the Intel(R) Ethernet Adapters and Devices User Guide for detai… in i40e_check_recovery_mode()
15216 set_bit(__I40E_RECOVERY_MODE, pf->state); in i40e_check_recovery_mode()
15220 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_check_recovery_mode()
15221 …dev_info(&pf->pdev->dev, "Please do Power-On Reset to initialize adapter in normal mode with full … in i40e_check_recovery_mode()
15247 static i40e_status i40e_pf_loop_reset(struct i40e_pf *pf) in i40e_pf_loop_reset() argument
15252 struct i40e_hw *hw = &pf->hw; in i40e_pf_loop_reset()
15262 pf->pfr_count++; in i40e_pf_loop_reset()
15264 dev_info(&pf->pdev->dev, "PF reset failed: %d\n", ret); in i40e_pf_loop_reset()
15280 static bool i40e_check_fw_empr(struct i40e_pf *pf) in i40e_check_fw_empr() argument
15282 const u32 fw_sts = rd32(&pf->hw, I40E_GL_FWSTS) & in i40e_check_fw_empr()
15299 static i40e_status i40e_handle_resets(struct i40e_pf *pf) in i40e_handle_resets() argument
15301 const i40e_status pfr = i40e_pf_loop_reset(pf); in i40e_handle_resets()
15302 const bool is_empr = i40e_check_fw_empr(pf); in i40e_handle_resets()
15305 …dev_crit(&pf->pdev->dev, "Entering recovery mode due to repeated FW resets. This may take several … in i40e_handle_resets()
15320 static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw) in i40e_init_recovery_mode() argument
15326 pci_save_state(pf->pdev); in i40e_init_recovery_mode()
15329 timer_setup(&pf->service_timer, i40e_service_timer, 0); in i40e_init_recovery_mode()
15330 pf->service_timer_period = HZ; in i40e_init_recovery_mode()
15332 INIT_WORK(&pf->service_task, i40e_service_task); in i40e_init_recovery_mode()
15333 clear_bit(__I40E_SERVICE_SCHED, pf->state); in i40e_init_recovery_mode()
15335 err = i40e_init_interrupt_scheme(pf); in i40e_init_recovery_mode()
15344 if (pf->hw.func_caps.num_vsis < I40E_MIN_VSI_ALLOC) in i40e_init_recovery_mode()
15345 pf->num_alloc_vsi = I40E_MIN_VSI_ALLOC; in i40e_init_recovery_mode()
15347 pf->num_alloc_vsi = pf->hw.func_caps.num_vsis; in i40e_init_recovery_mode()
15350 pf->vsi = kcalloc(pf->num_alloc_vsi, sizeof(struct i40e_vsi *), in i40e_init_recovery_mode()
15352 if (!pf->vsi) { in i40e_init_recovery_mode()
15360 v_idx = i40e_vsi_mem_alloc(pf, I40E_VSI_MAIN); in i40e_init_recovery_mode()
15365 pf->lan_vsi = v_idx; in i40e_init_recovery_mode()
15366 vsi = pf->vsi[v_idx]; in i40e_init_recovery_mode()
15379 i40e_dbg_pf_init(pf); in i40e_init_recovery_mode()
15381 err = i40e_setup_misc_vector_for_recovery_mode(pf); in i40e_init_recovery_mode()
15386 i40e_send_version(pf); in i40e_init_recovery_mode()
15389 mod_timer(&pf->service_timer, in i40e_init_recovery_mode()
15390 round_jiffies(jiffies + pf->service_timer_period)); in i40e_init_recovery_mode()
15395 i40e_reset_interrupt_capability(pf); in i40e_init_recovery_mode()
15396 del_timer_sync(&pf->service_timer); in i40e_init_recovery_mode()
15399 pci_disable_pcie_error_reporting(pf->pdev); in i40e_init_recovery_mode()
15400 pci_release_mem_regions(pf->pdev); in i40e_init_recovery_mode()
15401 pci_disable_device(pf->pdev); in i40e_init_recovery_mode()
15402 kfree(pf); in i40e_init_recovery_mode()
15441 struct i40e_pf *pf; in i40e_probe() local
15478 pf = kzalloc(sizeof(*pf), GFP_KERNEL); in i40e_probe()
15479 if (!pf) { in i40e_probe()
15483 pf->next_vsi = 0; in i40e_probe()
15484 pf->pdev = pdev; in i40e_probe()
15485 set_bit(__I40E_DOWN, pf->state); in i40e_probe()
15487 hw = &pf->hw; in i40e_probe()
15488 hw->back = pf; in i40e_probe()
15490 pf->ioremap_len = min_t(int, pci_resource_len(pdev, 0), in i40e_probe()
15497 if (pf->ioremap_len < I40E_GLGEN_STAT_CLEAR) { in i40e_probe()
15499 pf->ioremap_len); in i40e_probe()
15503 hw->hw_addr = ioremap(pci_resource_start(pdev, 0), pf->ioremap_len); in i40e_probe()
15508 pf->ioremap_len, err); in i40e_probe()
15519 pf->instance = pfs_found; in i40e_probe()
15528 INIT_LIST_HEAD(&pf->l3_flex_pit_list); in i40e_probe()
15529 INIT_LIST_HEAD(&pf->l4_flex_pit_list); in i40e_probe()
15530 INIT_LIST_HEAD(&pf->ddp_old_prof); in i40e_probe()
15538 pf->msg_enable = netif_msg_init(debug, in i40e_probe()
15543 pf->hw.debug_mask = debug; in i40e_probe()
15551 pf->corer_count++; in i40e_probe()
15566 err = i40e_handle_resets(pf); in i40e_probe()
15570 i40e_check_recovery_mode(pf); in i40e_probe()
15581 pf->adminq_work_limit = I40E_AQ_WORK_LIMIT; in i40e_probe()
15583 snprintf(pf->int_name, sizeof(pf->int_name) - 1, in i40e_probe()
15585 dev_driver_string(&pf->pdev->dev), dev_name(&pdev->dev)); in i40e_probe()
15595 pf->hw.fc.requested_mode = I40E_FC_NONE; in i40e_probe()
15637 i40e_verify_eeprom(pf); in i40e_probe()
15645 err = i40e_get_capabilities(pf, i40e_aqc_opc_list_func_capabilities); in i40e_probe()
15649 err = i40e_sw_init(pf); in i40e_probe()
15655 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_probe()
15656 return i40e_init_recovery_mode(pf, hw); in i40e_probe()
15676 if (pf->hw_features & I40E_HW_STOP_FW_LLDP) { in i40e_probe()
15682 i40e_get_platform_mac_addr(pdev, pf); in i40e_probe()
15693 pf->hw_features |= I40E_HW_PORT_ID_VALID; in i40e_probe()
15695 i40e_ptp_alloc_pins(pf); in i40e_probe()
15696 pci_set_drvdata(pdev, pf); in i40e_probe()
15700 status = i40e_get_fw_lldp_status(&pf->hw, &lldp_status); in i40e_probe()
15703 (pf->flags &= ~I40E_FLAG_DISABLE_FW_LLDP) : in i40e_probe()
15704 (pf->flags |= I40E_FLAG_DISABLE_FW_LLDP); in i40e_probe()
15706 (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) ? in i40e_probe()
15713 err = i40e_init_pf_dcb(pf); in i40e_probe()
15716 pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | I40E_FLAG_DCB_ENABLED); in i40e_probe()
15722 timer_setup(&pf->service_timer, i40e_service_timer, 0); in i40e_probe()
15723 pf->service_timer_period = HZ; in i40e_probe()
15725 INIT_WORK(&pf->service_task, i40e_service_task); in i40e_probe()
15726 clear_bit(__I40E_SERVICE_SCHED, pf->state); in i40e_probe()
15731 pf->wol_en = false; in i40e_probe()
15733 pf->wol_en = true; in i40e_probe()
15734 device_set_wakeup_enable(&pf->pdev->dev, pf->wol_en); in i40e_probe()
15737 i40e_determine_queue_usage(pf); in i40e_probe()
15738 err = i40e_init_interrupt_scheme(pf); in i40e_probe()
15748 pf->num_lan_msix = 1; in i40e_probe()
15750 pf->udp_tunnel_nic.set_port = i40e_udp_tunnel_set_port; in i40e_probe()
15751 pf->udp_tunnel_nic.unset_port = i40e_udp_tunnel_unset_port; in i40e_probe()
15752 pf->udp_tunnel_nic.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP; in i40e_probe()
15753 pf->udp_tunnel_nic.shared = &pf->udp_tunnel_shared; in i40e_probe()
15754 pf->udp_tunnel_nic.tables[0].n_entries = I40E_MAX_PF_UDP_OFFLOAD_PORTS; in i40e_probe()
15755 pf->udp_tunnel_nic.tables[0].tunnel_types = UDP_TUNNEL_TYPE_VXLAN | in i40e_probe()
15763 if (pf->hw.func_caps.num_vsis < I40E_MIN_VSI_ALLOC) in i40e_probe()
15764 pf->num_alloc_vsi = I40E_MIN_VSI_ALLOC; in i40e_probe()
15766 pf->num_alloc_vsi = pf->hw.func_caps.num_vsis; in i40e_probe()
15767 if (pf->num_alloc_vsi > UDP_TUNNEL_NIC_MAX_SHARING_DEVICES) { in i40e_probe()
15768 dev_warn(&pf->pdev->dev, in i40e_probe()
15770 pf->num_alloc_vsi, UDP_TUNNEL_NIC_MAX_SHARING_DEVICES); in i40e_probe()
15771 pf->num_alloc_vsi = UDP_TUNNEL_NIC_MAX_SHARING_DEVICES; in i40e_probe()
15775 pf->vsi = kcalloc(pf->num_alloc_vsi, sizeof(struct i40e_vsi *), in i40e_probe()
15777 if (!pf->vsi) { in i40e_probe()
15784 if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) && in i40e_probe()
15785 (pf->flags & I40E_FLAG_MSIX_ENABLED) && in i40e_probe()
15786 !test_bit(__I40E_BAD_EEPROM, pf->state)) { in i40e_probe()
15788 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_probe()
15791 err = i40e_setup_pf_switch(pf, false, false); in i40e_probe()
15796 INIT_LIST_HEAD(&pf->vsi[pf->lan_vsi]->ch_list); in i40e_probe()
15799 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_probe()
15800 if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) { in i40e_probe()
15801 i40e_vsi_open(pf->vsi[i]); in i40e_probe()
15809 err = i40e_aq_set_phy_int_mask(&pf->hw, in i40e_probe()
15814 dev_info(&pf->pdev->dev, "set phy mask fail, err %s aq_err %s\n", in i40e_probe()
15815 i40e_stat_str(&pf->hw, err), in i40e_probe()
15816 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_probe()
15829 if (pf->hw_features & I40E_HW_RESTART_AUTONEG) { in i40e_probe()
15831 err = i40e_aq_set_link_restart_an(&pf->hw, true, NULL); in i40e_probe()
15833 dev_info(&pf->pdev->dev, "link restart failed, err %s aq_err %s\n", in i40e_probe()
15834 i40e_stat_str(&pf->hw, err), in i40e_probe()
15835 i40e_aq_str(&pf->hw, in i40e_probe()
15836 pf->hw.aq.asq_last_status)); in i40e_probe()
15842 clear_bit(__I40E_DOWN, pf->state); in i40e_probe()
15849 if (pf->flags & I40E_FLAG_MSIX_ENABLED) { in i40e_probe()
15850 err = i40e_setup_misc_vector(pf); in i40e_probe()
15854 i40e_cloud_filter_exit(pf); in i40e_probe()
15855 i40e_fdir_teardown(pf); in i40e_probe()
15862 if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) && in i40e_probe()
15863 (pf->flags & I40E_FLAG_MSIX_ENABLED) && in i40e_probe()
15864 !test_bit(__I40E_BAD_EEPROM, pf->state)) { in i40e_probe()
15874 err = i40e_alloc_vfs(pf, pci_num_vf(pdev)); in i40e_probe()
15883 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_probe()
15884 pf->iwarp_base_vector = i40e_get_lump(pf, pf->irq_pile, in i40e_probe()
15885 pf->num_iwarp_msix, in i40e_probe()
15887 if (pf->iwarp_base_vector < 0) { in i40e_probe()
15890 pf->num_iwarp_msix, pf->iwarp_base_vector); in i40e_probe()
15891 pf->flags &= ~I40E_FLAG_IWARP_ENABLED; in i40e_probe()
15895 i40e_dbg_pf_init(pf); in i40e_probe()
15898 i40e_send_version(pf); in i40e_probe()
15901 mod_timer(&pf->service_timer, in i40e_probe()
15902 round_jiffies(jiffies + pf->service_timer_period)); in i40e_probe()
15905 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_probe()
15906 err = i40e_lan_add_device(pf); in i40e_probe()
15918 if (!(pf->hw_features & I40E_HW_NO_PCI_LINK_CHECK)) { in i40e_probe()
15925 pcie_capability_read_word(pf->pdev, PCI_EXP_LNKSTA, in i40e_probe()
15966 dev_dbg(&pf->pdev->dev, "get requested speeds ret = %s last_status = %s\n", in i40e_probe()
15967 i40e_stat_str(&pf->hw, err), in i40e_probe()
15968 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_probe()
15969 pf->hw.phy.link_info.requested_speeds = abilities.link_speed; in i40e_probe()
15972 i40e_set_fec_in_flags(abilities.fec_cfg_curr_mod_ext_info, &pf->flags); in i40e_probe()
15977 dev_dbg(&pf->pdev->dev, "get supported phy types ret = %s last_status = %s\n", in i40e_probe()
15978 i40e_stat_str(&pf->hw, err), in i40e_probe()
15979 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_probe()
15983 val = (rd32(&pf->hw, I40E_PRTGL_SAH) & in i40e_probe()
15995 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, in i40e_probe()
15996 pf->main_vsi_seid); in i40e_probe()
15998 if ((pf->hw.device_id == I40E_DEV_ID_10G_BASE_T) || in i40e_probe()
15999 (pf->hw.device_id == I40E_DEV_ID_10G_BASE_T4)) in i40e_probe()
16000 pf->hw_features |= I40E_HW_PHY_CONTROLS_LEDS; in i40e_probe()
16001 if (pf->hw.device_id == I40E_DEV_ID_SFP_I_X722) in i40e_probe()
16002 pf->hw_features |= I40E_HW_HAVE_CRT_RETIMER; in i40e_probe()
16004 i40e_print_features(pf); in i40e_probe()
16010 set_bit(__I40E_DOWN, pf->state); in i40e_probe()
16011 i40e_clear_interrupt_scheme(pf); in i40e_probe()
16012 kfree(pf->vsi); in i40e_probe()
16014 i40e_reset_interrupt_capability(pf); in i40e_probe()
16015 del_timer_sync(&pf->service_timer); in i40e_probe()
16020 kfree(pf->qp_pile); in i40e_probe()
16026 kfree(pf); in i40e_probe()
16047 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_remove() local
16048 struct i40e_hw *hw = &pf->hw; in i40e_remove()
16052 i40e_dbg_pf_exit(pf); in i40e_remove()
16054 i40e_ptp_stop(pf); in i40e_remove()
16064 while (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) in i40e_remove()
16066 set_bit(__I40E_IN_REMOVE, pf->state); in i40e_remove()
16068 if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { in i40e_remove()
16069 set_bit(__I40E_VF_RESETS_DISABLED, pf->state); in i40e_remove()
16070 i40e_free_vfs(pf); in i40e_remove()
16071 pf->flags &= ~I40E_FLAG_SRIOV_ENABLED; in i40e_remove()
16074 set_bit(__I40E_SUSPENDED, pf->state); in i40e_remove()
16075 set_bit(__I40E_DOWN, pf->state); in i40e_remove()
16076 if (pf->service_timer.function) in i40e_remove()
16077 del_timer_sync(&pf->service_timer); in i40e_remove()
16078 if (pf->service_task.func) in i40e_remove()
16079 cancel_work_sync(&pf->service_task); in i40e_remove()
16081 if (test_bit(__I40E_RECOVERY_MODE, pf->state)) { in i40e_remove()
16082 struct i40e_vsi *vsi = pf->vsi[0]; in i40e_remove()
16097 i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false); in i40e_remove()
16099 i40e_fdir_teardown(pf); in i40e_remove()
16105 if (!pf->veb[i]) in i40e_remove()
16108 if (pf->veb[i]->uplink_seid == pf->mac_seid || in i40e_remove()
16109 pf->veb[i]->uplink_seid == 0) in i40e_remove()
16110 i40e_switch_branch_release(pf->veb[i]); in i40e_remove()
16116 if (pf->vsi[pf->lan_vsi]) in i40e_remove()
16117 i40e_vsi_release(pf->vsi[pf->lan_vsi]); in i40e_remove()
16119 i40e_cloud_filter_exit(pf); in i40e_remove()
16122 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { in i40e_remove()
16123 ret_code = i40e_lan_del_device(pf); in i40e_remove()
16140 if (test_bit(__I40E_RECOVERY_MODE, pf->state) && in i40e_remove()
16141 !(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_remove()
16142 free_irq(pf->pdev->irq, pf); in i40e_remove()
16153 i40e_clear_interrupt_scheme(pf); in i40e_remove()
16154 for (i = 0; i < pf->num_alloc_vsi; i++) { in i40e_remove()
16155 if (pf->vsi[i]) { in i40e_remove()
16156 if (!test_bit(__I40E_RECOVERY_MODE, pf->state)) in i40e_remove()
16157 i40e_vsi_clear_rings(pf->vsi[i]); in i40e_remove()
16158 i40e_vsi_clear(pf->vsi[i]); in i40e_remove()
16159 pf->vsi[i] = NULL; in i40e_remove()
16165 kfree(pf->veb[i]); in i40e_remove()
16166 pf->veb[i] = NULL; in i40e_remove()
16169 kfree(pf->qp_pile); in i40e_remove()
16170 kfree(pf->vsi); in i40e_remove()
16173 kfree(pf); in i40e_remove()
16192 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_detected() local
16196 if (!pf) { in i40e_pci_error_detected()
16203 if (!test_bit(__I40E_SUSPENDED, pf->state)) in i40e_pci_error_detected()
16204 i40e_prep_for_reset(pf); in i40e_pci_error_detected()
16221 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_slot_reset() local
16236 reg = rd32(&pf->hw, I40E_GLGEN_RTRIG); in i40e_pci_error_slot_reset()
16252 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_reset_prepare() local
16254 i40e_prep_for_reset(pf); in i40e_pci_error_reset_prepare()
16263 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_reset_done() local
16265 if (test_bit(__I40E_IN_REMOVE, pf->state)) in i40e_pci_error_reset_done()
16268 i40e_reset_and_rebuild(pf, false, false); in i40e_pci_error_reset_done()
16280 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_error_resume() local
16283 if (test_bit(__I40E_SUSPENDED, pf->state)) in i40e_pci_error_resume()
16286 i40e_handle_reset_warning(pf, false); in i40e_pci_error_resume()
16294 static void i40e_enable_mc_magic_wake(struct i40e_pf *pf) in i40e_enable_mc_magic_wake() argument
16296 struct i40e_hw *hw = &pf->hw; in i40e_enable_mc_magic_wake()
16302 if (pf->vsi[pf->lan_vsi] && pf->vsi[pf->lan_vsi]->netdev) { in i40e_enable_mc_magic_wake()
16304 pf->vsi[pf->lan_vsi]->netdev->dev_addr); in i40e_enable_mc_magic_wake()
16306 dev_err(&pf->pdev->dev, in i40e_enable_mc_magic_wake()
16322 dev_err(&pf->pdev->dev, in i40e_enable_mc_magic_wake()
16332 dev_err(&pf->pdev->dev, in i40e_enable_mc_magic_wake()
16342 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_shutdown() local
16343 struct i40e_hw *hw = &pf->hw; in i40e_shutdown()
16345 set_bit(__I40E_SUSPENDED, pf->state); in i40e_shutdown()
16346 set_bit(__I40E_DOWN, pf->state); in i40e_shutdown()
16348 del_timer_sync(&pf->service_timer); in i40e_shutdown()
16349 cancel_work_sync(&pf->service_task); in i40e_shutdown()
16350 i40e_cloud_filter_exit(pf); in i40e_shutdown()
16351 i40e_fdir_teardown(pf); in i40e_shutdown()
16356 i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false); in i40e_shutdown()
16358 if (pf->wol_en && (pf->hw_features & I40E_HW_WOL_MC_MAGIC_PKT_WAKE)) in i40e_shutdown()
16359 i40e_enable_mc_magic_wake(pf); in i40e_shutdown()
16361 i40e_prep_for_reset(pf); in i40e_shutdown()
16364 (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); in i40e_shutdown()
16366 (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); in i40e_shutdown()
16369 if (test_bit(__I40E_RECOVERY_MODE, pf->state) && in i40e_shutdown()
16370 !(pf->flags & I40E_FLAG_MSIX_ENABLED)) in i40e_shutdown()
16371 free_irq(pf->pdev->irq, pf); in i40e_shutdown()
16378 i40e_clear_interrupt_scheme(pf); in i40e_shutdown()
16382 pci_wake_from_d3(pdev, pf->wol_en); in i40e_shutdown()
16393 struct i40e_pf *pf = dev_get_drvdata(dev); in i40e_suspend() local
16394 struct i40e_hw *hw = &pf->hw; in i40e_suspend()
16397 if (test_and_set_bit(__I40E_SUSPENDED, pf->state)) in i40e_suspend()
16400 set_bit(__I40E_DOWN, pf->state); in i40e_suspend()
16403 del_timer_sync(&pf->service_timer); in i40e_suspend()
16404 cancel_work_sync(&pf->service_task); in i40e_suspend()
16409 i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false); in i40e_suspend()
16411 if (pf->wol_en && (pf->hw_features & I40E_HW_WOL_MC_MAGIC_PKT_WAKE)) in i40e_suspend()
16412 i40e_enable_mc_magic_wake(pf); in i40e_suspend()
16420 i40e_prep_for_reset(pf); in i40e_suspend()
16422 wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); in i40e_suspend()
16423 wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); in i40e_suspend()
16430 i40e_clear_interrupt_scheme(pf); in i40e_suspend()
16443 struct i40e_pf *pf = dev_get_drvdata(dev); in i40e_resume() local
16447 if (!test_bit(__I40E_SUSPENDED, pf->state)) in i40e_resume()
16458 err = i40e_restore_interrupt_scheme(pf); in i40e_resume()
16464 clear_bit(__I40E_DOWN, pf->state); in i40e_resume()
16465 i40e_reset_and_rebuild(pf, false, true); in i40e_resume()
16470 clear_bit(__I40E_SUSPENDED, pf->state); in i40e_resume()
16473 mod_timer(&pf->service_timer, in i40e_resume()
16474 round_jiffies(jiffies + pf->service_timer_period)); in i40e_resume()