Lines Matching full:pf
43 static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type);
45 static void ice_vsi_release_all(struct ice_pf *pf);
66 * @pf: pointer to PF struct
68 static void ice_check_for_hang_subtask(struct ice_pf *pf) in ice_check_for_hang_subtask() argument
76 ice_for_each_vsi(pf, v) in ice_check_for_hang_subtask()
77 if (pf->vsi[v] && pf->vsi[v]->type == ICE_VSI_PF) { in ice_check_for_hang_subtask()
78 vsi = pf->vsi[v]; in ice_check_for_hang_subtask()
120 * @pf: board private structure
122 * Set initial set of MAC filters for PF VSI; configure filters for permanent
126 static int ice_init_mac_fltr(struct ice_pf *pf) in ice_init_mac_fltr() argument
132 vsi = ice_get_main_vsi(pf); in ice_init_mac_fltr()
145 dev_err(ice_pf_to_dev(pf), "Could not add MAC filters error %s. Unregistering device\n", in ice_init_mac_fltr()
213 * ice_cfg_promisc - Enable or disable promiscuous mode for a given PF
256 struct ice_pf *pf = vsi->back; in ice_vsi_sync_fltr() local
257 struct ice_hw *hw = &pf->hw; in ice_vsi_sync_fltr()
363 if (!ice_is_dflt_vsi_in_use(pf->first_sw)) { in ice_vsi_sync_fltr()
364 err = ice_set_dflt_vsi(pf->first_sw, vsi); in ice_vsi_sync_fltr()
376 if (ice_is_vsi_dflt_vsi(pf->first_sw, vsi)) { in ice_vsi_sync_fltr()
377 err = ice_clear_dflt_vsi(pf->first_sw); in ice_vsi_sync_fltr()
406 * @pf: board private structure
408 static void ice_sync_fltr_subtask(struct ice_pf *pf) in ice_sync_fltr_subtask() argument
412 if (!pf || !(test_bit(ICE_FLAG_FLTR_SYNC, pf->flags))) in ice_sync_fltr_subtask()
415 clear_bit(ICE_FLAG_FLTR_SYNC, pf->flags); in ice_sync_fltr_subtask()
417 ice_for_each_vsi(pf, v) in ice_sync_fltr_subtask()
418 if (pf->vsi[v] && ice_vsi_fltr_changed(pf->vsi[v]) && in ice_sync_fltr_subtask()
419 ice_vsi_sync_fltr(pf->vsi[v])) { in ice_sync_fltr_subtask()
421 set_bit(ICE_FLAG_FLTR_SYNC, pf->flags); in ice_sync_fltr_subtask()
427 * ice_pf_dis_all_vsi - Pause all VSIs on a PF
428 * @pf: the PF
431 static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked) in ice_pf_dis_all_vsi() argument
435 ice_for_each_vsi(pf, v) in ice_pf_dis_all_vsi()
436 if (pf->vsi[v]) in ice_pf_dis_all_vsi()
437 ice_dis_vsi(pf->vsi[v], locked); in ice_pf_dis_all_vsi()
442 * @pf: board private structure
447 ice_prepare_for_reset(struct ice_pf *pf) in ice_prepare_for_reset() argument
449 struct ice_hw *hw = &pf->hw; in ice_prepare_for_reset()
453 if (test_bit(__ICE_PREPARED_FOR_RESET, pf->state)) in ice_prepare_for_reset()
458 ice_vc_notify_reset(pf); in ice_prepare_for_reset()
461 ice_for_each_vf(pf, i) in ice_prepare_for_reset()
462 ice_set_vf_state_qs_dis(&pf->vf[i]); in ice_prepare_for_reset()
467 ice_pf_dis_all_vsi(pf, false); in ice_prepare_for_reset()
474 set_bit(__ICE_PREPARED_FOR_RESET, pf->state); in ice_prepare_for_reset()
479 * @pf: board private structure
483 static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type) in ice_do_reset() argument
485 struct device *dev = ice_pf_to_dev(pf); in ice_do_reset()
486 struct ice_hw *hw = &pf->hw; in ice_do_reset()
490 ice_prepare_for_reset(pf); in ice_do_reset()
495 set_bit(__ICE_RESET_FAILED, pf->state); in ice_do_reset()
496 clear_bit(__ICE_RESET_OICR_RECV, pf->state); in ice_do_reset()
497 clear_bit(__ICE_PREPARED_FOR_RESET, pf->state); in ice_do_reset()
498 clear_bit(__ICE_PFR_REQ, pf->state); in ice_do_reset()
499 clear_bit(__ICE_CORER_REQ, pf->state); in ice_do_reset()
500 clear_bit(__ICE_GLOBR_REQ, pf->state); in ice_do_reset()
509 pf->pfr_count++; in ice_do_reset()
510 ice_rebuild(pf, reset_type); in ice_do_reset()
511 clear_bit(__ICE_PREPARED_FOR_RESET, pf->state); in ice_do_reset()
512 clear_bit(__ICE_PFR_REQ, pf->state); in ice_do_reset()
513 ice_reset_all_vfs(pf, true); in ice_do_reset()
519 * @pf: board private structure
521 static void ice_reset_subtask(struct ice_pf *pf) in ice_reset_subtask() argument
527 * of reset is pending and sets bits in pf->state indicating the reset in ice_reset_subtask()
529 * prepare for pending reset if not already (for PF software-initiated in ice_reset_subtask()
535 if (test_bit(__ICE_RESET_OICR_RECV, pf->state)) { in ice_reset_subtask()
537 if (test_and_clear_bit(__ICE_CORER_RECV, pf->state)) in ice_reset_subtask()
539 if (test_and_clear_bit(__ICE_GLOBR_RECV, pf->state)) in ice_reset_subtask()
541 if (test_and_clear_bit(__ICE_EMPR_RECV, pf->state)) in ice_reset_subtask()
546 ice_prepare_for_reset(pf); in ice_reset_subtask()
549 if (ice_check_reset(&pf->hw)) { in ice_reset_subtask()
550 set_bit(__ICE_RESET_FAILED, pf->state); in ice_reset_subtask()
553 pf->hw.reset_ongoing = false; in ice_reset_subtask()
554 ice_rebuild(pf, reset_type); in ice_reset_subtask()
558 clear_bit(__ICE_RESET_OICR_RECV, pf->state); in ice_reset_subtask()
559 clear_bit(__ICE_PREPARED_FOR_RESET, pf->state); in ice_reset_subtask()
560 clear_bit(__ICE_PFR_REQ, pf->state); in ice_reset_subtask()
561 clear_bit(__ICE_CORER_REQ, pf->state); in ice_reset_subtask()
562 clear_bit(__ICE_GLOBR_REQ, pf->state); in ice_reset_subtask()
563 ice_reset_all_vfs(pf, true); in ice_reset_subtask()
570 if (test_bit(__ICE_PFR_REQ, pf->state)) in ice_reset_subtask()
572 if (test_bit(__ICE_CORER_REQ, pf->state)) in ice_reset_subtask()
574 if (test_bit(__ICE_GLOBR_REQ, pf->state)) in ice_reset_subtask()
581 if (!test_bit(__ICE_DOWN, pf->state) && in ice_reset_subtask()
582 !test_bit(__ICE_CFG_BUSY, pf->state)) { in ice_reset_subtask()
583 ice_do_reset(pf, reset_type); in ice_reset_subtask()
773 * @pf: private PF struct
782 static void ice_set_dflt_mib(struct ice_pf *pf) in ice_set_dflt_mib() argument
784 struct device *dev = ice_pf_to_dev(pf); in ice_set_dflt_mib()
791 if (!pf) { in ice_set_dflt_mib()
792 dev_dbg(dev, "%s NULL pf pointer\n", __func__); in ice_set_dflt_mib()
796 hw = &pf->hw; in ice_set_dflt_mib()
867 * @pf: PF that the link event is associated with
875 ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up, in ice_link_event() argument
878 struct device *dev = ice_pf_to_dev(pf); in ice_link_event()
905 vsi = ice_get_main_vsi(pf); in ice_link_event()
910 if (!test_bit(ICE_FLAG_NO_MEDIA, pf->flags) && in ice_link_event()
912 set_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_link_event()
926 if (ice_is_dcb_active(pf)) { in ice_link_event()
927 if (test_bit(ICE_FLAG_DCB_ENA, pf->flags)) in ice_link_event()
928 ice_dcb_rebuild(pf); in ice_link_event()
931 ice_set_dflt_mib(pf); in ice_link_event()
936 ice_vc_notify_link_state(pf); in ice_link_event()
943 * @pf: board private structure
945 static void ice_watchdog_subtask(struct ice_pf *pf) in ice_watchdog_subtask() argument
950 if (test_bit(__ICE_DOWN, pf->state) || in ice_watchdog_subtask()
951 test_bit(__ICE_CFG_BUSY, pf->state)) in ice_watchdog_subtask()
956 pf->serv_tmr_prev + pf->serv_tmr_period)) in ice_watchdog_subtask()
959 pf->serv_tmr_prev = jiffies; in ice_watchdog_subtask()
964 ice_update_pf_stats(pf); in ice_watchdog_subtask()
965 ice_for_each_vsi(pf, i) in ice_watchdog_subtask()
966 if (pf->vsi[i] && pf->vsi[i]->netdev) in ice_watchdog_subtask()
967 ice_update_vsi_stats(pf->vsi[i]); in ice_watchdog_subtask()
1000 * @pf: PF that the link event is associated with
1004 ice_handle_link_event(struct ice_pf *pf, struct ice_rq_event_info *event) in ice_handle_link_event() argument
1011 port_info = pf->hw.port_info; in ice_handle_link_event()
1015 status = ice_link_event(pf, port_info, in ice_handle_link_event()
1019 dev_dbg(ice_pf_to_dev(pf), "Could not process link event, error %d\n", in ice_handle_link_event()
1041 * @pf: pointer to the PF private structure
1046 * Waits for a specific AdminQ completion event on the ARQ for a given PF. The
1056 int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, in ice_aq_wait_for_event() argument
1059 struct device *dev = ice_pf_to_dev(pf); in ice_aq_wait_for_event()
1074 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1075 hlist_add_head(&task->entry, &pf->aq_wait_list); in ice_aq_wait_for_event()
1076 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1080 ret = wait_event_interruptible_timeout(pf->aq_wait_queue, task->state, in ice_aq_wait_for_event()
1103 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1105 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1113 * @pf: pointer to the PF private structure
1129 static void ice_aq_check_events(struct ice_pf *pf, u16 opcode, in ice_aq_check_events() argument
1135 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_check_events()
1136 hlist_for_each_entry(task, &pf->aq_wait_list, entry) { in ice_aq_check_events()
1154 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_check_events()
1157 wake_up(&pf->aq_wait_queue); in ice_aq_check_events()
1162 * @pf: the PF private structure
1167 static void ice_aq_cancel_waiting_tasks(struct ice_pf *pf) in ice_aq_cancel_waiting_tasks() argument
1171 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_cancel_waiting_tasks()
1172 hlist_for_each_entry(task, &pf->aq_wait_list, entry) in ice_aq_cancel_waiting_tasks()
1174 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_cancel_waiting_tasks()
1176 wake_up(&pf->aq_wait_queue); in ice_aq_cancel_waiting_tasks()
1181 * @pf: ptr to struct ice_pf
1184 static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type) in __ice_clean_ctrlq() argument
1186 struct device *dev = ice_pf_to_dev(pf); in __ice_clean_ctrlq()
1188 struct ice_hw *hw = &pf->hw; in __ice_clean_ctrlq()
1194 /* Do not clean control queue if/when PF reset fails */ in __ice_clean_ctrlq()
1195 if (test_bit(__ICE_RESET_FAILED, pf->state)) in __ice_clean_ctrlq()
1276 ice_aq_check_events(pf, opcode, &event); in __ice_clean_ctrlq()
1280 if (ice_handle_link_event(pf, &event)) in __ice_clean_ctrlq()
1284 ice_vf_lan_overflow_event(pf, &event); in __ice_clean_ctrlq()
1287 ice_vc_process_vf_msg(pf, &event); in __ice_clean_ctrlq()
1293 ice_dcb_process_lldp_set_mib_change(pf, &event); in __ice_clean_ctrlq()
1324 * @pf: board private structure
1326 static void ice_clean_adminq_subtask(struct ice_pf *pf) in ice_clean_adminq_subtask() argument
1328 struct ice_hw *hw = &pf->hw; in ice_clean_adminq_subtask()
1330 if (!test_bit(__ICE_ADMINQ_EVENT_PENDING, pf->state)) in ice_clean_adminq_subtask()
1333 if (__ice_clean_ctrlq(pf, ICE_CTL_Q_ADMIN)) in ice_clean_adminq_subtask()
1336 clear_bit(__ICE_ADMINQ_EVENT_PENDING, pf->state); in ice_clean_adminq_subtask()
1344 __ice_clean_ctrlq(pf, ICE_CTL_Q_ADMIN); in ice_clean_adminq_subtask()
1351 * @pf: board private structure
1353 static void ice_clean_mailboxq_subtask(struct ice_pf *pf) in ice_clean_mailboxq_subtask() argument
1355 struct ice_hw *hw = &pf->hw; in ice_clean_mailboxq_subtask()
1357 if (!test_bit(__ICE_MAILBOXQ_EVENT_PENDING, pf->state)) in ice_clean_mailboxq_subtask()
1360 if (__ice_clean_ctrlq(pf, ICE_CTL_Q_MAILBOX)) in ice_clean_mailboxq_subtask()
1363 clear_bit(__ICE_MAILBOXQ_EVENT_PENDING, pf->state); in ice_clean_mailboxq_subtask()
1366 __ice_clean_ctrlq(pf, ICE_CTL_Q_MAILBOX); in ice_clean_mailboxq_subtask()
1373 * @pf: board private structure
1377 void ice_service_task_schedule(struct ice_pf *pf) in ice_service_task_schedule() argument
1379 if (!test_bit(__ICE_SERVICE_DIS, pf->state) && in ice_service_task_schedule()
1380 !test_and_set_bit(__ICE_SERVICE_SCHED, pf->state) && in ice_service_task_schedule()
1381 !test_bit(__ICE_NEEDS_RESTART, pf->state)) in ice_service_task_schedule()
1382 queue_work(ice_wq, &pf->serv_task); in ice_service_task_schedule()
1387 * @pf: board private structure
1389 static void ice_service_task_complete(struct ice_pf *pf) in ice_service_task_complete() argument
1391 WARN_ON(!test_bit(__ICE_SERVICE_SCHED, pf->state)); in ice_service_task_complete()
1393 /* force memory (pf->state) to sync before next service task */ in ice_service_task_complete()
1395 clear_bit(__ICE_SERVICE_SCHED, pf->state); in ice_service_task_complete()
1400 * @pf: board private structure
1405 static int ice_service_task_stop(struct ice_pf *pf) in ice_service_task_stop() argument
1409 ret = test_and_set_bit(__ICE_SERVICE_DIS, pf->state); in ice_service_task_stop()
1411 if (pf->serv_tmr.function) in ice_service_task_stop()
1412 del_timer_sync(&pf->serv_tmr); in ice_service_task_stop()
1413 if (pf->serv_task.func) in ice_service_task_stop()
1414 cancel_work_sync(&pf->serv_task); in ice_service_task_stop()
1416 clear_bit(__ICE_SERVICE_SCHED, pf->state); in ice_service_task_stop()
1422 * @pf: board private structure
1426 static void ice_service_task_restart(struct ice_pf *pf) in ice_service_task_restart() argument
1428 clear_bit(__ICE_SERVICE_DIS, pf->state); in ice_service_task_restart()
1429 ice_service_task_schedule(pf); in ice_service_task_restart()
1438 struct ice_pf *pf = from_timer(pf, t, serv_tmr); in ice_service_timer() local
1440 mod_timer(&pf->serv_tmr, round_jiffies(pf->serv_tmr_period + jiffies)); in ice_service_timer()
1441 ice_service_task_schedule(pf); in ice_service_timer()
1446 * @pf: pointer to the PF structure
1449 * VF MDD logging is guarded by net_ratelimit. Additional PF and VF log
1451 * disable the queue, the PF can be configured to reset the VF using ethtool
1454 static void ice_handle_mdd_event(struct ice_pf *pf) in ice_handle_mdd_event() argument
1456 struct device *dev = ice_pf_to_dev(pf); in ice_handle_mdd_event()
1457 struct ice_hw *hw = &pf->hw; in ice_handle_mdd_event()
1461 if (!test_and_clear_bit(__ICE_MDD_EVENT_PENDING, pf->state)) { in ice_handle_mdd_event()
1465 ice_print_vfs_mdd_events(pf); in ice_handle_mdd_event()
1481 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1482 dev_info(dev, "Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\n", in ice_handle_mdd_event()
1498 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1499 dev_info(dev, "Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\n", in ice_handle_mdd_event()
1515 if (netif_msg_rx_err(pf)) in ice_handle_mdd_event()
1516 dev_info(dev, "Malicious Driver Detection event %d on RX queue %d PF# %d VF# %d\n", in ice_handle_mdd_event()
1521 /* check to see if this PF caused an MDD event */ in ice_handle_mdd_event()
1525 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1526 dev_info(dev, "Malicious Driver Detection event TX_PQM detected on PF\n"); in ice_handle_mdd_event()
1532 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1533 dev_info(dev, "Malicious Driver Detection event TX_TCLAN detected on PF\n"); in ice_handle_mdd_event()
1539 if (netif_msg_rx_err(pf)) in ice_handle_mdd_event()
1540 dev_info(dev, "Malicious Driver Detection event RX detected on PF\n"); in ice_handle_mdd_event()
1546 ice_for_each_vf(pf, i) { in ice_handle_mdd_event()
1547 struct ice_vf *vf = &pf->vf[i]; in ice_handle_mdd_event()
1553 set_bit(__ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1554 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1563 set_bit(__ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1564 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1573 set_bit(__ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1574 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1583 set_bit(__ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1584 if (netif_msg_rx_err(pf)) in ice_handle_mdd_event()
1589 * PF can be configured to reset the VF through ethtool in ice_handle_mdd_event()
1592 if (test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)) { in ice_handle_mdd_event()
1597 ice_reset_vf(&pf->vf[i], false); in ice_handle_mdd_event()
1602 ice_print_vfs_mdd_events(pf); in ice_handle_mdd_event()
1690 struct ice_pf *pf = pi->hw->back; in ice_init_nvm_phy_type() local
1702 dev_err(ice_pf_to_dev(pf), "Get PHY capability failed.\n"); in ice_init_nvm_phy_type()
1707 pf->nvm_phy_type_hi = pcaps->phy_type_high; in ice_init_nvm_phy_type()
1708 pf->nvm_phy_type_lo = pcaps->phy_type_low; in ice_init_nvm_phy_type()
1724 struct ice_pf *pf = pi->hw->back; in ice_init_link_dflt_override() local
1726 ldo = &pf->link_dflt_override; in ice_init_link_dflt_override()
1736 set_bit(ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA, pf->flags); in ice_init_link_dflt_override()
1737 set_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags); in ice_init_link_dflt_override()
1759 struct ice_pf *pf = pi->hw->back; in ice_init_phy_cfg_dflt_override() local
1761 ldo = &pf->link_dflt_override; in ice_init_phy_cfg_dflt_override()
1769 cfg->phy_type_low = pf->nvm_phy_type_lo & in ice_init_phy_cfg_dflt_override()
1771 cfg->phy_type_high = pf->nvm_phy_type_hi & in ice_init_phy_cfg_dflt_override()
1777 set_bit(__ICE_LINK_DEFAULT_OVERRIDE_PENDING, pf->state); in ice_init_phy_cfg_dflt_override()
1798 struct ice_pf *pf = pi->hw->back; in ice_init_phy_user_cfg() local
1806 vsi = ice_get_main_vsi(pf); in ice_init_phy_user_cfg()
1817 dev_err(ice_pf_to_dev(pf), "Get PHY capability failed.\n"); in ice_init_phy_user_cfg()
1828 set_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags); in ice_init_phy_user_cfg()
1833 if (pf->link_dflt_override.options & ICE_LINK_OVERRIDE_EN) { in ice_init_phy_user_cfg()
1848 set_bit(__ICE_PHY_INIT_COMPLETE, pf->state); in ice_init_phy_user_cfg()
1984 * @pf: pointer to PF struct
1989 static void ice_check_media_subtask(struct ice_pf *pf) in ice_check_media_subtask() argument
1996 if (!test_bit(ICE_FLAG_NO_MEDIA, pf->flags)) in ice_check_media_subtask()
1999 vsi = ice_get_main_vsi(pf); in ice_check_media_subtask()
2010 if (!test_bit(__ICE_PHY_INIT_COMPLETE, pf->state)) in ice_check_media_subtask()
2022 clear_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_check_media_subtask()
2032 * @work: pointer to work_struct contained by the PF struct
2036 struct ice_pf *pf = container_of(work, struct ice_pf, serv_task); in ice_service_task() local
2042 ice_reset_subtask(pf); in ice_service_task()
2045 if (ice_is_reset_in_progress(pf->state) || in ice_service_task()
2046 test_bit(__ICE_SUSPENDED, pf->state) || in ice_service_task()
2047 test_bit(__ICE_NEEDS_RESTART, pf->state)) { in ice_service_task()
2048 ice_service_task_complete(pf); in ice_service_task()
2052 ice_clean_adminq_subtask(pf); in ice_service_task()
2053 ice_check_media_subtask(pf); in ice_service_task()
2054 ice_check_for_hang_subtask(pf); in ice_service_task()
2055 ice_sync_fltr_subtask(pf); in ice_service_task()
2056 ice_handle_mdd_event(pf); in ice_service_task()
2057 ice_watchdog_subtask(pf); in ice_service_task()
2059 if (ice_is_safe_mode(pf)) { in ice_service_task()
2060 ice_service_task_complete(pf); in ice_service_task()
2064 ice_process_vflr_event(pf); in ice_service_task()
2065 ice_clean_mailboxq_subtask(pf); in ice_service_task()
2066 ice_sync_arfs_fltrs(pf); in ice_service_task()
2068 ice_service_task_complete(pf); in ice_service_task()
2074 if (time_after(jiffies, (start_time + pf->serv_tmr_period)) || in ice_service_task()
2075 test_bit(__ICE_MDD_EVENT_PENDING, pf->state) || in ice_service_task()
2076 test_bit(__ICE_VFLR_EVENT_PENDING, pf->state) || in ice_service_task()
2077 test_bit(__ICE_MAILBOXQ_EVENT_PENDING, pf->state) || in ice_service_task()
2078 test_bit(__ICE_ADMINQ_EVENT_PENDING, pf->state)) in ice_service_task()
2079 mod_timer(&pf->serv_tmr, jiffies); in ice_service_task()
2100 * @pf: board private structure
2103 int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset) in ice_schedule_reset() argument
2105 struct device *dev = ice_pf_to_dev(pf); in ice_schedule_reset()
2108 if (test_bit(__ICE_RESET_FAILED, pf->state)) { in ice_schedule_reset()
2113 if (ice_is_reset_in_progress(pf->state)) { in ice_schedule_reset()
2120 set_bit(__ICE_PFR_REQ, pf->state); in ice_schedule_reset()
2123 set_bit(__ICE_CORER_REQ, pf->state); in ice_schedule_reset()
2126 set_bit(__ICE_GLOBR_REQ, pf->state); in ice_schedule_reset()
2132 ice_service_task_schedule(pf); in ice_schedule_reset()
2188 struct ice_pf *pf = vsi->back; in ice_vsi_req_irq_msix() local
2196 dev = ice_pf_to_dev(pf); in ice_vsi_req_irq_msix()
2200 irq_num = pf->msix_entries[base + vector].vector; in ice_vsi_req_irq_msix()
2244 irq_num = pf->msix_entries[base + vector].vector; in ice_vsi_req_irq_msix()
2325 struct ice_pf *pf = vsi->back; in ice_prepare_xdp_rings() local
2327 .qs_mutex = &pf->avail_q_mutex, in ice_prepare_xdp_rings()
2328 .pf_map = pf->avail_txqs, in ice_prepare_xdp_rings()
2329 .pf_map_size = pf->max_pf_txqs, in ice_prepare_xdp_rings()
2340 dev = ice_pf_to_dev(pf); in ice_prepare_xdp_rings()
2376 if (ice_is_reset_in_progress(pf->state)) in ice_prepare_xdp_rings()
2403 mutex_lock(&pf->avail_q_mutex); in ice_prepare_xdp_rings()
2405 clear_bit(vsi->txq_map[i + vsi->alloc_txq], pf->avail_txqs); in ice_prepare_xdp_rings()
2408 mutex_unlock(&pf->avail_q_mutex); in ice_prepare_xdp_rings()
2418 * Detach XDP rings from irq vectors, clean up the PF bitmap and free
2424 struct ice_pf *pf = vsi->back; in ice_destroy_xdp_rings() local
2429 * in pf->state won't be set, so additionally check first q_vector in ice_destroy_xdp_rings()
2432 if (ice_is_reset_in_progress(pf->state) || !vsi->q_vectors[0]) in ice_destroy_xdp_rings()
2448 mutex_lock(&pf->avail_q_mutex); in ice_destroy_xdp_rings()
2450 clear_bit(vsi->txq_map[i + vsi->alloc_txq], pf->avail_txqs); in ice_destroy_xdp_rings()
2453 mutex_unlock(&pf->avail_q_mutex); in ice_destroy_xdp_rings()
2463 devm_kfree(ice_pf_to_dev(pf), vsi->xdp_rings); in ice_destroy_xdp_rings()
2466 if (ice_is_reset_in_progress(pf->state) || !vsi->q_vectors[0]) in ice_destroy_xdp_rings()
2553 NL_SET_ERR_MSG_MOD(xdp->extack, "XDP can be loaded only on PF VSI"); in ice_xdp()
2570 * @pf: board private structure
2572 static void ice_ena_misc_vector(struct ice_pf *pf) in ice_ena_misc_vector() argument
2574 struct ice_hw *hw = &pf->hw; in ice_ena_misc_vector()
2600 wr32(hw, GLINT_DYN_CTL(pf->oicr_idx), in ice_ena_misc_vector()
2611 struct ice_pf *pf = (struct ice_pf *)data; in ice_misc_intr() local
2612 struct ice_hw *hw = &pf->hw; in ice_misc_intr()
2617 dev = ice_pf_to_dev(pf); in ice_misc_intr()
2618 set_bit(__ICE_ADMINQ_EVENT_PENDING, pf->state); in ice_misc_intr()
2619 set_bit(__ICE_MAILBOXQ_EVENT_PENDING, pf->state); in ice_misc_intr()
2626 pf->sw_int_count++; in ice_misc_intr()
2631 set_bit(__ICE_MDD_EVENT_PENDING, pf->state); in ice_misc_intr()
2635 if (test_bit(__ICE_VF_RESETS_DISABLED, pf->state)) { in ice_misc_intr()
2642 set_bit(__ICE_VFLR_EVENT_PENDING, pf->state); in ice_misc_intr()
2655 pf->corer_count++; in ice_misc_intr()
2657 pf->globr_count++; in ice_misc_intr()
2659 pf->empr_count++; in ice_misc_intr()
2664 * pf->state so that the service task can start a reset/rebuild. in ice_misc_intr()
2668 if (!test_and_set_bit(__ICE_RESET_OICR_RECV, pf->state)) { in ice_misc_intr()
2670 set_bit(__ICE_CORER_RECV, pf->state); in ice_misc_intr()
2672 set_bit(__ICE_GLOBR_RECV, pf->state); in ice_misc_intr()
2674 set_bit(__ICE_EMPR_RECV, pf->state); in ice_misc_intr()
2682 * __ICE_RESET_OICR_RECV in pf->state indicates in ice_misc_intr()
2710 set_bit(__ICE_PFR_REQ, pf->state); in ice_misc_intr()
2711 ice_service_task_schedule(pf); in ice_misc_intr()
2716 ice_service_task_schedule(pf); in ice_misc_intr()
2745 * @pf: board private structure
2747 static void ice_free_irq_msix_misc(struct ice_pf *pf) in ice_free_irq_msix_misc() argument
2749 struct ice_hw *hw = &pf->hw; in ice_free_irq_msix_misc()
2757 if (pf->msix_entries) { in ice_free_irq_msix_misc()
2758 synchronize_irq(pf->msix_entries[pf->oicr_idx].vector); in ice_free_irq_msix_misc()
2759 devm_free_irq(ice_pf_to_dev(pf), in ice_free_irq_msix_misc()
2760 pf->msix_entries[pf->oicr_idx].vector, pf); in ice_free_irq_msix_misc()
2763 pf->num_avail_sw_msix += 1; in ice_free_irq_msix_misc()
2764 ice_free_res(pf->irq_tracker, pf->oicr_idx, ICE_RES_MISC_VEC_ID); in ice_free_irq_msix_misc()
2795 * @pf: board private structure
2801 static int ice_req_irq_msix_misc(struct ice_pf *pf) in ice_req_irq_msix_misc() argument
2803 struct device *dev = ice_pf_to_dev(pf); in ice_req_irq_msix_misc()
2804 struct ice_hw *hw = &pf->hw; in ice_req_irq_msix_misc()
2807 if (!pf->int_name[0]) in ice_req_irq_msix_misc()
2808 snprintf(pf->int_name, sizeof(pf->int_name) - 1, "%s-%s:misc", in ice_req_irq_msix_misc()
2815 if (ice_is_reset_in_progress(pf->state)) in ice_req_irq_msix_misc()
2819 oicr_idx = ice_get_res(pf, pf->irq_tracker, 1, ICE_RES_MISC_VEC_ID); in ice_req_irq_msix_misc()
2823 pf->num_avail_sw_msix -= 1; in ice_req_irq_msix_misc()
2824 pf->oicr_idx = (u16)oicr_idx; in ice_req_irq_msix_misc()
2826 err = devm_request_irq(dev, pf->msix_entries[pf->oicr_idx].vector, in ice_req_irq_msix_misc()
2827 ice_misc_intr, 0, pf->int_name, pf); in ice_req_irq_msix_misc()
2830 pf->int_name, err); in ice_req_irq_msix_misc()
2831 ice_free_res(pf->irq_tracker, 1, ICE_RES_MISC_VEC_ID); in ice_req_irq_msix_misc()
2832 pf->num_avail_sw_msix += 1; in ice_req_irq_msix_misc()
2837 ice_ena_misc_vector(pf); in ice_req_irq_msix_misc()
2839 ice_ena_ctrlq_interrupts(hw, pf->oicr_idx); in ice_req_irq_msix_misc()
2840 wr32(hw, GLINT_ITR(ICE_RX_ITR, pf->oicr_idx), in ice_req_irq_msix_misc()
2875 struct ice_pf *pf = ice_netdev_to_pf(netdev); in ice_set_ops() local
2877 if (ice_is_safe_mode(pf)) { in ice_set_ops()
2884 netdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic; in ice_set_ops()
2894 struct ice_pf *pf = ice_netdev_to_pf(netdev); in ice_set_netdev_features() local
2900 if (ice_is_safe_mode(pf)) { in ice_set_netdev_features()
2959 struct ice_pf *pf = vsi->back; in ice_cfg_netdev() local
2985 SET_NETDEV_DEV(netdev, ice_pf_to_dev(pf)); in ice_cfg_netdev()
3038 * ice_pf_vsi_setup - Set up a PF VSI
3039 * @pf: board private structure
3046 ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_pf_vsi_setup() argument
3048 return ice_vsi_setup(pf, pi, ICE_VSI_PF, ICE_INVAL_VFID); in ice_pf_vsi_setup()
3053 * @pf: board private structure
3060 ice_ctrl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_ctrl_vsi_setup() argument
3062 return ice_vsi_setup(pf, pi, ICE_VSI_CTRL, ICE_INVAL_VFID); in ice_ctrl_vsi_setup()
3067 * @pf: board private structure
3074 ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_lb_vsi_setup() argument
3076 return ice_vsi_setup(pf, pi, ICE_VSI_LB, ICE_INVAL_VFID); in ice_lb_vsi_setup()
3168 * @pf: board private structure
3172 static int ice_setup_pf_sw(struct ice_pf *pf) in ice_setup_pf_sw() argument
3177 if (ice_is_reset_in_progress(pf->state)) in ice_setup_pf_sw()
3180 vsi = ice_pf_vsi_setup(pf, pf->hw.port_info); in ice_setup_pf_sw()
3203 dev_err(ice_pf_to_dev(pf), "Failed to set CPU Rx map VSI %d error %d\n", in ice_setup_pf_sw()
3208 status = ice_init_mac_fltr(pf); in ice_setup_pf_sw()
3255 * @pf: pointer to an ice_pf instance
3257 u16 ice_get_avail_txq_count(struct ice_pf *pf) in ice_get_avail_txq_count() argument
3259 return ice_get_avail_q_count(pf->avail_txqs, &pf->avail_q_mutex, in ice_get_avail_txq_count()
3260 pf->max_pf_txqs); in ice_get_avail_txq_count()
3265 * @pf: pointer to an ice_pf instance
3267 u16 ice_get_avail_rxq_count(struct ice_pf *pf) in ice_get_avail_rxq_count() argument
3269 return ice_get_avail_q_count(pf->avail_rxqs, &pf->avail_q_mutex, in ice_get_avail_rxq_count()
3270 pf->max_pf_rxqs); in ice_get_avail_rxq_count()
3275 * @pf: board private structure to initialize
3277 static void ice_deinit_pf(struct ice_pf *pf) in ice_deinit_pf() argument
3279 ice_service_task_stop(pf); in ice_deinit_pf()
3280 mutex_destroy(&pf->sw_mutex); in ice_deinit_pf()
3281 mutex_destroy(&pf->tc_mutex); in ice_deinit_pf()
3282 mutex_destroy(&pf->avail_q_mutex); in ice_deinit_pf()
3284 if (pf->avail_txqs) { in ice_deinit_pf()
3285 bitmap_free(pf->avail_txqs); in ice_deinit_pf()
3286 pf->avail_txqs = NULL; in ice_deinit_pf()
3289 if (pf->avail_rxqs) { in ice_deinit_pf()
3290 bitmap_free(pf->avail_rxqs); in ice_deinit_pf()
3291 pf->avail_rxqs = NULL; in ice_deinit_pf()
3297 * @pf: pointer to the PF instance
3299 static void ice_set_pf_caps(struct ice_pf *pf) in ice_set_pf_caps() argument
3301 struct ice_hw_func_caps *func_caps = &pf->hw.func_caps; in ice_set_pf_caps()
3303 clear_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); in ice_set_pf_caps()
3305 set_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); in ice_set_pf_caps()
3306 clear_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags); in ice_set_pf_caps()
3308 set_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags); in ice_set_pf_caps()
3309 pf->num_vfs_supported = min_t(int, func_caps->num_allocd_vfs, in ice_set_pf_caps()
3312 clear_bit(ICE_FLAG_RSS_ENA, pf->flags); in ice_set_pf_caps()
3314 set_bit(ICE_FLAG_RSS_ENA, pf->flags); in ice_set_pf_caps()
3316 clear_bit(ICE_FLAG_FD_ENA, pf->flags); in ice_set_pf_caps()
3323 pf->ctrl_vsi_idx = ICE_NO_VSI; in ice_set_pf_caps()
3324 set_bit(ICE_FLAG_FD_ENA, pf->flags); in ice_set_pf_caps()
3325 /* force guaranteed filter pool for PF */ in ice_set_pf_caps()
3326 ice_alloc_fd_guar_item(&pf->hw, &unused, in ice_set_pf_caps()
3328 /* force shared filter pool for PF */ in ice_set_pf_caps()
3329 ice_alloc_fd_shrd_item(&pf->hw, &unused, in ice_set_pf_caps()
3333 pf->max_pf_txqs = func_caps->common_cap.num_txq; in ice_set_pf_caps()
3334 pf->max_pf_rxqs = func_caps->common_cap.num_rxq; in ice_set_pf_caps()
3339 * @pf: board private structure to initialize
3341 static int ice_init_pf(struct ice_pf *pf) in ice_init_pf() argument
3343 ice_set_pf_caps(pf); in ice_init_pf()
3345 mutex_init(&pf->sw_mutex); in ice_init_pf()
3346 mutex_init(&pf->tc_mutex); in ice_init_pf()
3348 INIT_HLIST_HEAD(&pf->aq_wait_list); in ice_init_pf()
3349 spin_lock_init(&pf->aq_wait_lock); in ice_init_pf()
3350 init_waitqueue_head(&pf->aq_wait_queue); in ice_init_pf()
3353 timer_setup(&pf->serv_tmr, ice_service_timer, 0); in ice_init_pf()
3354 pf->serv_tmr_period = HZ; in ice_init_pf()
3355 INIT_WORK(&pf->serv_task, ice_service_task); in ice_init_pf()
3356 clear_bit(__ICE_SERVICE_SCHED, pf->state); in ice_init_pf()
3358 mutex_init(&pf->avail_q_mutex); in ice_init_pf()
3359 pf->avail_txqs = bitmap_zalloc(pf->max_pf_txqs, GFP_KERNEL); in ice_init_pf()
3360 if (!pf->avail_txqs) in ice_init_pf()
3363 pf->avail_rxqs = bitmap_zalloc(pf->max_pf_rxqs, GFP_KERNEL); in ice_init_pf()
3364 if (!pf->avail_rxqs) { in ice_init_pf()
3365 devm_kfree(ice_pf_to_dev(pf), pf->avail_txqs); in ice_init_pf()
3366 pf->avail_txqs = NULL; in ice_init_pf()
3375 * @pf: board private structure
3380 static int ice_ena_msix_range(struct ice_pf *pf) in ice_ena_msix_range() argument
3382 struct device *dev = ice_pf_to_dev(pf); in ice_ena_msix_range()
3386 v_left = pf->hw.func_caps.common_cap.num_msix_vectors; in ice_ena_msix_range()
3399 pf->num_lan_msix = needed; in ice_ena_msix_range()
3404 if (test_bit(ICE_FLAG_FD_ENA, pf->flags)) { in ice_ena_msix_range()
3412 pf->msix_entries = devm_kcalloc(dev, v_budget, in ice_ena_msix_range()
3413 sizeof(*pf->msix_entries), GFP_KERNEL); in ice_ena_msix_range()
3415 if (!pf->msix_entries) { in ice_ena_msix_range()
3421 pf->msix_entries[i].entry = i; in ice_ena_msix_range()
3424 v_actual = pci_enable_msix_range(pf->pdev, pf->msix_entries, in ice_ena_msix_range()
3443 pci_disable_msix(pf->pdev); in ice_ena_msix_range()
3447 pf->num_lan_msix = ICE_MIN_LAN_VECS; in ice_ena_msix_range()
3454 devm_kfree(dev, pf->msix_entries); in ice_ena_msix_range()
3462 pf->num_lan_msix = 0; in ice_ena_msix_range()
3468 * @pf: board private structure
3470 static void ice_dis_msix(struct ice_pf *pf) in ice_dis_msix() argument
3472 pci_disable_msix(pf->pdev); in ice_dis_msix()
3473 devm_kfree(ice_pf_to_dev(pf), pf->msix_entries); in ice_dis_msix()
3474 pf->msix_entries = NULL; in ice_dis_msix()
3479 * @pf: board private structure
3481 static void ice_clear_interrupt_scheme(struct ice_pf *pf) in ice_clear_interrupt_scheme() argument
3483 ice_dis_msix(pf); in ice_clear_interrupt_scheme()
3485 if (pf->irq_tracker) { in ice_clear_interrupt_scheme()
3486 devm_kfree(ice_pf_to_dev(pf), pf->irq_tracker); in ice_clear_interrupt_scheme()
3487 pf->irq_tracker = NULL; in ice_clear_interrupt_scheme()
3493 * @pf: board private structure to initialize
3495 static int ice_init_interrupt_scheme(struct ice_pf *pf) in ice_init_interrupt_scheme() argument
3499 vectors = ice_ena_msix_range(pf); in ice_init_interrupt_scheme()
3505 pf->irq_tracker = in ice_init_interrupt_scheme()
3506 devm_kzalloc(ice_pf_to_dev(pf), sizeof(*pf->irq_tracker) + in ice_init_interrupt_scheme()
3508 if (!pf->irq_tracker) { in ice_init_interrupt_scheme()
3509 ice_dis_msix(pf); in ice_init_interrupt_scheme()
3514 pf->num_avail_sw_msix = (u16)vectors; in ice_init_interrupt_scheme()
3515 pf->irq_tracker->num_entries = (u16)vectors; in ice_init_interrupt_scheme()
3516 pf->irq_tracker->end = pf->irq_tracker->num_entries; in ice_init_interrupt_scheme()
3523 * @pf: board private structure
3528 bool ice_is_wol_supported(struct ice_pf *pf) in ice_is_wol_supported() argument
3530 struct ice_hw *hw = &pf->hw; in ice_is_wol_supported()
3534 * word) indicates WoL is not supported on the corresponding PF ID. in ice_is_wol_supported()
3554 struct ice_pf *pf = vsi->back; in ice_vsi_recfg_qs() local
3560 while (test_and_set_bit(__ICE_CFG_BUSY, pf->state)) { in ice_vsi_recfg_qs()
3575 dev_dbg(ice_pf_to_dev(pf), "Link is down, queue count change happens when link is brought up\n"); in ice_vsi_recfg_qs()
3581 ice_pf_dcb_recfg(pf); in ice_vsi_recfg_qs()
3584 clear_bit(__ICE_CFG_BUSY, pf->state); in ice_vsi_recfg_qs()
3589 * ice_set_safe_mode_vlan_cfg - configure PF VSI to allow all VLANs in safe mode
3590 * @pf: PF to configure
3592 * No VLAN offloads/filtering are advertised in safe mode so make sure the PF
3595 static void ice_set_safe_mode_vlan_cfg(struct ice_pf *pf) in ice_set_safe_mode_vlan_cfg() argument
3597 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_set_safe_mode_vlan_cfg()
3609 hw = &pf->hw; in ice_set_safe_mode_vlan_cfg()
3650 struct ice_pf *pf = (struct ice_pf *)hw->back; in ice_log_pkg_init() local
3651 struct device *dev = ice_pf_to_dev(pf); in ice_log_pkg_init()
3754 * @pf: pointer to the PF instance
3760 ice_load_pkg(const struct firmware *firmware, struct ice_pf *pf) in ice_load_pkg() argument
3763 struct device *dev = ice_pf_to_dev(pf); in ice_load_pkg()
3764 struct ice_hw *hw = &pf->hw; in ice_load_pkg()
3781 clear_bit(ICE_FLAG_ADV_FEATURES, pf->flags); in ice_load_pkg()
3788 set_bit(ICE_FLAG_ADV_FEATURES, pf->flags); in ice_load_pkg()
3793 * @pf: pointer to the PF structure
3799 static void ice_verify_cacheline_size(struct ice_pf *pf) in ice_verify_cacheline_size() argument
3801 if (rd32(&pf->hw, GLPCI_CNF2) & GLPCI_CNF2_CACHELINE_SIZE_M) in ice_verify_cacheline_size()
3802 …dev_warn(ice_pf_to_dev(pf), "%d Byte cache line assumption is invalid, driver may have Tx timeouts… in ice_verify_cacheline_size()
3808 * @pf: PF struct
3812 static enum ice_status ice_send_version(struct ice_pf *pf) in ice_send_version() argument
3822 return ice_aq_send_driver_ver(&pf->hw, &dv, NULL); in ice_send_version()
3827 * @pf: pointer to the PF instance
3831 static int ice_init_fdir(struct ice_pf *pf) in ice_init_fdir() argument
3833 struct device *dev = ice_pf_to_dev(pf); in ice_init_fdir()
3838 * Allocate it and store it in the PF. in ice_init_fdir()
3840 ctrl_vsi = ice_ctrl_vsi_setup(pf, pf->hw.port_info); in ice_init_fdir()
3852 mutex_init(&pf->hw.fdir_fltr_lock); in ice_init_fdir()
3854 err = ice_fdir_create_dflt_rules(pf); in ice_init_fdir()
3861 ice_fdir_release_flows(&pf->hw); in ice_init_fdir()
3865 if (pf->ctrl_vsi_idx != ICE_NO_VSI) { in ice_init_fdir()
3866 pf->vsi[pf->ctrl_vsi_idx] = NULL; in ice_init_fdir()
3867 pf->ctrl_vsi_idx = ICE_NO_VSI; in ice_init_fdir()
3874 * @pf: pointer to the PF instance
3876 static char *ice_get_opt_fw_name(struct ice_pf *pf) in ice_get_opt_fw_name() argument
3881 struct pci_dev *pdev = pf->pdev; in ice_get_opt_fw_name()
3904 * @pf: pointer to the PF instance
3906 static void ice_request_fw(struct ice_pf *pf) in ice_request_fw() argument
3908 char *opt_fw_filename = ice_get_opt_fw_name(pf); in ice_request_fw()
3910 struct device *dev = ice_pf_to_dev(pf); in ice_request_fw()
3925 ice_load_pkg(firmware, pf); in ice_request_fw()
3939 ice_load_pkg(firmware, pf); in ice_request_fw()
3945 * @pf: pointer to the PF struct
3947 static void ice_print_wake_reason(struct ice_pf *pf) in ice_print_wake_reason() argument
3949 u32 wus = pf->wakeup_reason; in ice_print_wake_reason()
3967 dev_info(ice_pf_to_dev(pf), "Wake reason: %s", wake_str); in ice_print_wake_reason()
3981 struct ice_pf *pf; in ice_probe() local
3998 pf = ice_allocate_pf(dev); in ice_probe()
3999 if (!pf) in ice_probe()
4014 pf->pdev = pdev; in ice_probe()
4015 pci_set_drvdata(pdev, pf); in ice_probe()
4016 set_bit(__ICE_DOWN, pf->state); in ice_probe()
4018 set_bit(__ICE_SERVICE_DIS, pf->state); in ice_probe()
4020 hw = &pf->hw; in ice_probe()
4024 hw->back = pf; in ice_probe()
4034 pf->msg_enable = netif_msg_init(debug, ICE_DFLT_NETIF_M); in ice_probe()
4036 err = ice_devlink_register(pf); in ice_probe()
4054 ice_request_fw(pf); in ice_probe()
4057 * set in pf->state, which will cause ice_is_safe_mode to return in ice_probe()
4060 if (ice_is_safe_mode(pf)) { in ice_probe()
4070 err = ice_init_pf(pf); in ice_probe()
4076 ice_devlink_init_regions(pf); in ice_probe()
4078 pf->hw.udp_tunnel_nic.set_port = ice_udp_tunnel_set_port; in ice_probe()
4079 pf->hw.udp_tunnel_nic.unset_port = ice_udp_tunnel_unset_port; in ice_probe()
4080 pf->hw.udp_tunnel_nic.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP; in ice_probe()
4081 pf->hw.udp_tunnel_nic.shared = &pf->hw.udp_tunnel_shared; in ice_probe()
4083 if (pf->hw.tnl.valid_count[TNL_VXLAN]) { in ice_probe()
4084 pf->hw.udp_tunnel_nic.tables[i].n_entries = in ice_probe()
4085 pf->hw.tnl.valid_count[TNL_VXLAN]; in ice_probe()
4086 pf->hw.udp_tunnel_nic.tables[i].tunnel_types = in ice_probe()
4090 if (pf->hw.tnl.valid_count[TNL_GENEVE]) { in ice_probe()
4091 pf->hw.udp_tunnel_nic.tables[i].n_entries = in ice_probe()
4092 pf->hw.tnl.valid_count[TNL_GENEVE]; in ice_probe()
4093 pf->hw.udp_tunnel_nic.tables[i].tunnel_types = in ice_probe()
4098 pf->num_alloc_vsi = hw->func_caps.guar_num_vsi; in ice_probe()
4099 if (!pf->num_alloc_vsi) { in ice_probe()
4103 if (pf->num_alloc_vsi > UDP_TUNNEL_NIC_MAX_SHARING_DEVICES) { in ice_probe()
4104 dev_warn(&pf->pdev->dev, in ice_probe()
4106 pf->num_alloc_vsi, UDP_TUNNEL_NIC_MAX_SHARING_DEVICES); in ice_probe()
4107 pf->num_alloc_vsi = UDP_TUNNEL_NIC_MAX_SHARING_DEVICES; in ice_probe()
4110 pf->vsi = devm_kcalloc(dev, pf->num_alloc_vsi, sizeof(*pf->vsi), in ice_probe()
4112 if (!pf->vsi) { in ice_probe()
4117 err = ice_init_interrupt_scheme(pf); in ice_probe()
4129 err = ice_req_irq_msix_misc(pf); in ice_probe()
4136 pf->first_sw = devm_kzalloc(dev, sizeof(*pf->first_sw), GFP_KERNEL); in ice_probe()
4137 if (!pf->first_sw) { in ice_probe()
4143 pf->first_sw->bridge_mode = BRIDGE_MODE_VEB; in ice_probe()
4145 pf->first_sw->bridge_mode = BRIDGE_MODE_VEPA; in ice_probe()
4147 pf->first_sw->pf = pf; in ice_probe()
4150 pf->first_sw->sw_id = hw->port_info->sw_id; in ice_probe()
4152 err = ice_setup_pf_sw(pf); in ice_probe()
4154 dev_err(dev, "probe failed due to setup PF switch: %d\n", err); in ice_probe()
4158 clear_bit(__ICE_SERVICE_DIS, pf->state); in ice_probe()
4161 err = ice_send_version(pf); in ice_probe()
4169 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); in ice_probe()
4171 err = ice_init_link_events(pf->hw.port_info); in ice_probe()
4177 err = ice_init_nvm_phy_type(pf->hw.port_info); in ice_probe()
4183 err = ice_update_link_info(pf->hw.port_info); in ice_probe()
4189 ice_init_link_dflt_override(pf->hw.port_info); in ice_probe()
4192 if (pf->hw.port_info->phy.link_info.link_info & in ice_probe()
4194 err = ice_init_phy_user_cfg(pf->hw.port_info); in ice_probe()
4200 if (!test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags)) { in ice_probe()
4201 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_probe()
4207 set_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_probe()
4210 ice_verify_cacheline_size(pf); in ice_probe()
4213 pf->wakeup_reason = rd32(hw, PFPM_WUS); in ice_probe()
4216 ice_print_wake_reason(pf); in ice_probe()
4224 if (ice_is_safe_mode(pf)) { in ice_probe()
4225 ice_set_safe_mode_vlan_cfg(pf); in ice_probe()
4232 if (ice_init_fdir(pf)) in ice_probe()
4236 if (ice_init_pf_dcb(pf, false)) { in ice_probe()
4237 clear_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); in ice_probe()
4238 clear_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_probe()
4240 ice_cfg_lldp_mib_change(&pf->hw, true); in ice_probe()
4244 pcie_print_link_status(pf->pdev); in ice_probe()
4248 clear_bit(__ICE_DOWN, pf->state); in ice_probe()
4252 ice_vsi_release_all(pf); in ice_probe()
4254 set_bit(__ICE_SERVICE_DIS, pf->state); in ice_probe()
4255 set_bit(__ICE_DOWN, pf->state); in ice_probe()
4256 devm_kfree(dev, pf->first_sw); in ice_probe()
4258 ice_free_irq_msix_misc(pf); in ice_probe()
4260 ice_clear_interrupt_scheme(pf); in ice_probe()
4262 devm_kfree(dev, pf->vsi); in ice_probe()
4264 ice_deinit_pf(pf); in ice_probe()
4265 ice_devlink_destroy_regions(pf); in ice_probe()
4268 ice_devlink_unregister(pf); in ice_probe()
4276 * @pf: pointer to the PF struct
4280 static void ice_set_wake(struct ice_pf *pf) in ice_set_wake() argument
4282 struct ice_hw *hw = &pf->hw; in ice_set_wake()
4283 bool wol = pf->wol_ena; in ice_set_wake()
4297 * @pf: pointer to the PF struct
4301 * wake, and that PF reset doesn't undo the LAA.
4303 static void ice_setup_mc_magic_wake(struct ice_pf *pf) in ice_setup_mc_magic_wake() argument
4305 struct device *dev = ice_pf_to_dev(pf); in ice_setup_mc_magic_wake()
4306 struct ice_hw *hw = &pf->hw; in ice_setup_mc_magic_wake()
4312 if (!pf->wol_ena) in ice_setup_mc_magic_wake()
4315 vsi = ice_get_main_vsi(pf); in ice_setup_mc_magic_wake()
4342 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_remove() local
4345 if (!pf) in ice_remove()
4349 if (!ice_is_reset_in_progress(pf->state)) in ice_remove()
4354 if (test_bit(ICE_FLAG_SRIOV_ENA, pf->flags)) { in ice_remove()
4355 set_bit(__ICE_VF_RESETS_DISABLED, pf->state); in ice_remove()
4356 ice_free_vfs(pf); in ice_remove()
4359 set_bit(__ICE_DOWN, pf->state); in ice_remove()
4360 ice_service_task_stop(pf); in ice_remove()
4362 ice_aq_cancel_waiting_tasks(pf); in ice_remove()
4364 mutex_destroy(&(&pf->hw)->fdir_fltr_lock); in ice_remove()
4365 if (!ice_is_safe_mode(pf)) in ice_remove()
4366 ice_remove_arfs(pf); in ice_remove()
4367 ice_setup_mc_magic_wake(pf); in ice_remove()
4368 ice_vsi_release_all(pf); in ice_remove()
4369 ice_set_wake(pf); in ice_remove()
4370 ice_free_irq_msix_misc(pf); in ice_remove()
4371 ice_for_each_vsi(pf, i) { in ice_remove()
4372 if (!pf->vsi[i]) in ice_remove()
4374 ice_vsi_free_q_vectors(pf->vsi[i]); in ice_remove()
4376 ice_deinit_pf(pf); in ice_remove()
4377 ice_devlink_destroy_regions(pf); in ice_remove()
4378 ice_deinit_hw(&pf->hw); in ice_remove()
4379 ice_devlink_unregister(pf); in ice_remove()
4385 ice_reset(&pf->hw, ICE_RESET_PFR); in ice_remove()
4387 ice_clear_interrupt_scheme(pf); in ice_remove()
4398 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_shutdown() local
4403 pci_wake_from_d3(pdev, pf->wol_ena); in ice_shutdown()
4411 * @pf: board private structure
4415 static void ice_prepare_for_shutdown(struct ice_pf *pf) in ice_prepare_for_shutdown() argument
4417 struct ice_hw *hw = &pf->hw; in ice_prepare_for_shutdown()
4422 ice_vc_notify_reset(pf); in ice_prepare_for_shutdown()
4424 dev_dbg(ice_pf_to_dev(pf), "Tearing down internal switch for shutdown\n"); in ice_prepare_for_shutdown()
4427 ice_pf_dis_all_vsi(pf, false); in ice_prepare_for_shutdown()
4429 ice_for_each_vsi(pf, v) in ice_prepare_for_shutdown()
4430 if (pf->vsi[v]) in ice_prepare_for_shutdown()
4431 pf->vsi[v]->vsi_num = 0; in ice_prepare_for_shutdown()
4438 * @pf: board private structure to reinitialize
4446 static int ice_reinit_interrupt_scheme(struct ice_pf *pf) in ice_reinit_interrupt_scheme() argument
4448 struct device *dev = ice_pf_to_dev(pf); in ice_reinit_interrupt_scheme()
4455 ret = ice_init_interrupt_scheme(pf); in ice_reinit_interrupt_scheme()
4462 ice_for_each_vsi(pf, v) { in ice_reinit_interrupt_scheme()
4463 if (!pf->vsi[v]) in ice_reinit_interrupt_scheme()
4466 ret = ice_vsi_alloc_q_vectors(pf->vsi[v]); in ice_reinit_interrupt_scheme()
4469 ice_vsi_map_rings_to_vectors(pf->vsi[v]); in ice_reinit_interrupt_scheme()
4472 ret = ice_req_irq_msix_misc(pf); in ice_reinit_interrupt_scheme()
4483 if (pf->vsi[v]) in ice_reinit_interrupt_scheme()
4484 ice_vsi_free_q_vectors(pf->vsi[v]); in ice_reinit_interrupt_scheme()
4499 struct ice_pf *pf; in ice_suspend() local
4502 pf = pci_get_drvdata(pdev); in ice_suspend()
4504 if (!ice_pf_state_is_nominal(pf)) { in ice_suspend()
4515 disabled = ice_service_task_stop(pf); in ice_suspend()
4518 if (test_and_set_bit(__ICE_SUSPENDED, pf->state)) { in ice_suspend()
4520 ice_service_task_restart(pf); in ice_suspend()
4524 if (test_bit(__ICE_DOWN, pf->state) || in ice_suspend()
4525 ice_is_reset_in_progress(pf->state)) { in ice_suspend()
4528 ice_service_task_restart(pf); in ice_suspend()
4532 ice_setup_mc_magic_wake(pf); in ice_suspend()
4534 ice_prepare_for_shutdown(pf); in ice_suspend()
4536 ice_set_wake(pf); in ice_suspend()
4543 ice_free_irq_msix_misc(pf); in ice_suspend()
4544 ice_for_each_vsi(pf, v) { in ice_suspend()
4545 if (!pf->vsi[v]) in ice_suspend()
4547 ice_vsi_free_q_vectors(pf->vsi[v]); in ice_suspend()
4549 ice_clear_interrupt_scheme(pf); in ice_suspend()
4552 pci_wake_from_d3(pdev, pf->wol_ena); in ice_suspend()
4565 struct ice_pf *pf; in ice_resume() local
4582 pf = pci_get_drvdata(pdev); in ice_resume()
4583 hw = &pf->hw; in ice_resume()
4585 pf->wakeup_reason = rd32(hw, PFPM_WUS); in ice_resume()
4586 ice_print_wake_reason(pf); in ice_resume()
4591 ret = ice_reinit_interrupt_scheme(pf); in ice_resume()
4595 clear_bit(__ICE_DOWN, pf->state); in ice_resume()
4596 /* Now perform PF reset and rebuild */ in ice_resume()
4599 clear_bit(__ICE_SERVICE_DIS, pf->state); in ice_resume()
4601 if (ice_schedule_reset(pf, reset_type)) in ice_resume()
4604 clear_bit(__ICE_SUSPENDED, pf->state); in ice_resume()
4605 ice_service_task_restart(pf); in ice_resume()
4608 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); in ice_resume()
4625 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_detected() local
4627 if (!pf) { in ice_pci_err_detected()
4633 if (!test_bit(__ICE_SUSPENDED, pf->state)) { in ice_pci_err_detected()
4634 ice_service_task_stop(pf); in ice_pci_err_detected()
4636 if (!test_bit(__ICE_PREPARED_FOR_RESET, pf->state)) { in ice_pci_err_detected()
4637 set_bit(__ICE_PFR_REQ, pf->state); in ice_pci_err_detected()
4638 ice_prepare_for_reset(pf); in ice_pci_err_detected()
4654 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_slot_reset() local
4671 reg = rd32(&pf->hw, GLGEN_RTRIG); in ice_pci_err_slot_reset()
4696 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_resume() local
4698 if (!pf) { in ice_pci_err_resume()
4704 if (test_bit(__ICE_SUSPENDED, pf->state)) { in ice_pci_err_resume()
4712 ice_do_reset(pf, ICE_RESET_PFR); in ice_pci_err_resume()
4713 ice_service_task_restart(pf); in ice_pci_err_resume()
4714 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); in ice_pci_err_resume()
4723 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_reset_prepare() local
4725 if (!test_bit(__ICE_SUSPENDED, pf->state)) { in ice_pci_err_reset_prepare()
4726 ice_service_task_stop(pf); in ice_pci_err_reset_prepare()
4728 if (!test_bit(__ICE_PREPARED_FOR_RESET, pf->state)) { in ice_pci_err_reset_prepare()
4729 set_bit(__ICE_PFR_REQ, pf->state); in ice_pci_err_reset_prepare()
4730 ice_prepare_for_reset(pf); in ice_pci_err_reset_prepare()
4858 struct ice_pf *pf = vsi->back; in ice_set_mac_address() local
4859 struct ice_hw *hw = &pf->hw; in ice_set_mac_address()
4876 if (test_bit(__ICE_DOWN, pf->state) || in ice_set_mac_address()
4877 ice_is_reset_in_progress(pf->state)) { in ice_set_mac_address()
5070 struct ice_pf *pf = vsi->back; in ice_set_features() local
5080 if (ice_is_reset_in_progress(pf->state)) { in ice_set_features()
5200 struct ice_pf *pf = vsi->back; in ice_up_complete() local
5225 ice_service_task_schedule(pf); in ice_up_complete()
5354 struct ice_pf *pf = vsi->back; in ice_update_vsi_stats() local
5357 test_bit(__ICE_CFG_BUSY, pf->state)) in ice_update_vsi_stats()
5373 cur_ns->rx_crc_errors = pf->stats.crc_errors; in ice_update_vsi_stats()
5374 cur_ns->rx_errors = pf->stats.crc_errors + in ice_update_vsi_stats()
5375 pf->stats.illegal_bytes + in ice_update_vsi_stats()
5376 pf->stats.rx_len_errors + in ice_update_vsi_stats()
5377 pf->stats.rx_undersize + in ice_update_vsi_stats()
5378 pf->hw_csum_rx_error + in ice_update_vsi_stats()
5379 pf->stats.rx_jabber + in ice_update_vsi_stats()
5380 pf->stats.rx_fragments + in ice_update_vsi_stats()
5381 pf->stats.rx_oversize; in ice_update_vsi_stats()
5382 cur_ns->rx_length_errors = pf->stats.rx_len_errors; in ice_update_vsi_stats()
5384 cur_ns->rx_missed_errors = pf->stats.eth.rx_discards; in ice_update_vsi_stats()
5389 * ice_update_pf_stats - Update PF port stats counters
5390 * @pf: PF whose stats needs to be updated
5392 void ice_update_pf_stats(struct ice_pf *pf) in ice_update_pf_stats() argument
5395 struct ice_hw *hw = &pf->hw; in ice_update_pf_stats()
5400 prev_ps = &pf->stats_prev; in ice_update_pf_stats()
5401 cur_ps = &pf->stats; in ice_update_pf_stats()
5403 ice_stat_update40(hw, GLPRT_GORCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5407 ice_stat_update40(hw, GLPRT_UPRCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5411 ice_stat_update40(hw, GLPRT_MPRCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5415 ice_stat_update40(hw, GLPRT_BPRCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5419 ice_stat_update32(hw, PRTRPB_RDPC, pf->stat_prev_loaded, in ice_update_pf_stats()
5423 ice_stat_update40(hw, GLPRT_GOTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5427 ice_stat_update40(hw, GLPRT_UPTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5431 ice_stat_update40(hw, GLPRT_MPTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5435 ice_stat_update40(hw, GLPRT_BPTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5439 ice_stat_update32(hw, GLPRT_TDOLD(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5443 ice_stat_update40(hw, GLPRT_PRC64L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5446 ice_stat_update40(hw, GLPRT_PRC127L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5449 ice_stat_update40(hw, GLPRT_PRC255L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5452 ice_stat_update40(hw, GLPRT_PRC511L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5455 ice_stat_update40(hw, GLPRT_PRC1023L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5458 ice_stat_update40(hw, GLPRT_PRC1522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5461 ice_stat_update40(hw, GLPRT_PRC9522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5464 ice_stat_update40(hw, GLPRT_PTC64L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5467 ice_stat_update40(hw, GLPRT_PTC127L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5470 ice_stat_update40(hw, GLPRT_PTC255L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5473 ice_stat_update40(hw, GLPRT_PTC511L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5476 ice_stat_update40(hw, GLPRT_PTC1023L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5479 ice_stat_update40(hw, GLPRT_PTC1522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5482 ice_stat_update40(hw, GLPRT_PTC9522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5489 pf->stat_prev_loaded, &prev_ps->fd_sb_match, in ice_update_pf_stats()
5491 ice_stat_update32(hw, GLPRT_LXONRXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5494 ice_stat_update32(hw, GLPRT_LXOFFRXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5497 ice_stat_update32(hw, GLPRT_LXONTXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5500 ice_stat_update32(hw, GLPRT_LXOFFTXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5503 ice_update_dcb_stats(pf); in ice_update_pf_stats()
5505 ice_stat_update32(hw, GLPRT_CRCERRS(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5508 ice_stat_update32(hw, GLPRT_ILLERRC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5511 ice_stat_update32(hw, GLPRT_MLFC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5515 ice_stat_update32(hw, GLPRT_MRFC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5519 ice_stat_update32(hw, GLPRT_RLEC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5522 ice_stat_update32(hw, GLPRT_RUC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5525 ice_stat_update32(hw, GLPRT_RFC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5528 ice_stat_update32(hw, GLPRT_ROC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5531 ice_stat_update32(hw, GLPRT_RJC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
5534 cur_ps->fd_sb_status = test_bit(ICE_FLAG_FD_ENA, pf->flags) ? 1 : 0; in ice_update_pf_stats()
5536 pf->stat_prev_loaded = true; in ice_update_pf_stats()
5731 struct ice_pf *pf = vsi->back; in ice_vsi_open_ctrl() local
5735 dev = ice_pf_to_dev(pf); in ice_vsi_open_ctrl()
5787 struct ice_pf *pf = vsi->back; in ice_vsi_open() local
5804 dev_driver_string(ice_pf_to_dev(pf)), vsi->netdev->name); in ice_vsi_open()
5838 * @pf: PF from which all VSIs are being removed
5840 static void ice_vsi_release_all(struct ice_pf *pf) in ice_vsi_release_all() argument
5844 if (!pf->vsi) in ice_vsi_release_all()
5847 ice_for_each_vsi(pf, i) { in ice_vsi_release_all()
5848 if (!pf->vsi[i]) in ice_vsi_release_all()
5851 err = ice_vsi_release(pf->vsi[i]); in ice_vsi_release_all()
5853 dev_dbg(ice_pf_to_dev(pf), "Failed to release pf->vsi[%d], err %d, vsi_num = %d\n", in ice_vsi_release_all()
5854 i, err, pf->vsi[i]->vsi_num); in ice_vsi_release_all()
5860 * @pf: pointer to the PF instance
5863 * Iterates through the pf->vsi array and rebuilds VSIs of the requested type
5865 static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type) in ice_vsi_rebuild_by_type() argument
5867 struct device *dev = ice_pf_to_dev(pf); in ice_vsi_rebuild_by_type()
5871 ice_for_each_vsi(pf, i) { in ice_vsi_rebuild_by_type()
5872 struct ice_vsi *vsi = pf->vsi[i]; in ice_vsi_rebuild_by_type()
5886 status = ice_replay_vsi(&pf->hw, vsi->idx); in ice_vsi_rebuild_by_type()
5897 vsi->vsi_num = ice_get_hw_vsi_num(&pf->hw, vsi->idx); in ice_vsi_rebuild_by_type()
5915 * ice_update_pf_netdev_link - Update PF netdev link status
5916 * @pf: pointer to the PF instance
5918 static void ice_update_pf_netdev_link(struct ice_pf *pf) in ice_update_pf_netdev_link() argument
5923 ice_for_each_vsi(pf, i) { in ice_update_pf_netdev_link()
5924 struct ice_vsi *vsi = pf->vsi[i]; in ice_update_pf_netdev_link()
5929 ice_get_link_status(pf->vsi[i]->port_info, &link_up); in ice_update_pf_netdev_link()
5931 netif_carrier_on(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
5932 netif_tx_wake_all_queues(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
5934 netif_carrier_off(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
5935 netif_tx_stop_all_queues(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
5942 * @pf: PF to rebuild
5950 static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) in ice_rebuild() argument
5952 struct device *dev = ice_pf_to_dev(pf); in ice_rebuild()
5953 struct ice_hw *hw = &pf->hw; in ice_rebuild()
5957 if (test_bit(__ICE_DOWN, pf->state)) in ice_rebuild()
5960 dev_dbg(dev, "rebuilding PF after reset_type=%d\n", reset_type); in ice_rebuild()
5970 if (!ice_is_safe_mode(pf)) { in ice_rebuild()
5976 ice_load_pkg(NULL, pf); in ice_rebuild()
5981 dev_err(dev, "clear PF configuration failed %s\n", in ice_rebuild()
5986 if (pf->first_sw->dflt_vsi_ena) in ice_rebuild()
5989 pf->first_sw->dflt_vsi = NULL; in ice_rebuild()
5990 pf->first_sw->dflt_vsi_ena = false; in ice_rebuild()
6011 err = ice_req_irq_msix_misc(pf); in ice_rebuild()
6017 if (test_bit(ICE_FLAG_FD_ENA, pf->flags)) { in ice_rebuild()
6025 /* force guaranteed filter pool for PF */ in ice_rebuild()
6027 /* force shared filter pool for PF */ in ice_rebuild()
6032 if (test_bit(ICE_FLAG_DCB_ENA, pf->flags)) in ice_rebuild()
6033 ice_dcb_rebuild(pf); in ice_rebuild()
6035 /* rebuild PF VSI */ in ice_rebuild()
6036 err = ice_vsi_rebuild_by_type(pf, ICE_VSI_PF); in ice_rebuild()
6038 dev_err(dev, "PF VSI rebuild failed: %d\n", err); in ice_rebuild()
6043 if (test_bit(ICE_FLAG_FD_ENA, pf->flags)) { in ice_rebuild()
6044 err = ice_vsi_rebuild_by_type(pf, ICE_VSI_CTRL); in ice_rebuild()
6055 ice_fdir_replay_fltrs(pf); in ice_rebuild()
6057 ice_rebuild_arfs(pf); in ice_rebuild()
6060 ice_update_pf_netdev_link(pf); in ice_rebuild()
6063 ret = ice_send_version(pf); in ice_rebuild()
6073 clear_bit(__ICE_RESET_FAILED, pf->state); in ice_rebuild()
6081 set_bit(__ICE_RESET_FAILED, pf->state); in ice_rebuild()
6083 /* set this bit in PF state to control service task scheduling */ in ice_rebuild()
6084 set_bit(__ICE_NEEDS_RESTART, pf->state); in ice_rebuild()
6111 struct ice_pf *pf = vsi->back; in ice_change_mtu() local
6140 if (ice_is_reset_in_progress(pf->state)) { in ice_change_mtu()
6300 struct ice_pf *pf = vsi->back; in ice_set_rss() local
6301 struct ice_hw *hw = &pf->hw; in ice_set_rss()
6305 dev = ice_pf_to_dev(pf); in ice_set_rss()
6345 struct ice_pf *pf = vsi->back; in ice_get_rss() local
6346 struct ice_hw *hw = &pf->hw; in ice_get_rss()
6350 dev = ice_pf_to_dev(pf); in ice_get_rss()
6395 struct ice_pf *pf = vsi->back; in ice_bridge_getlink() local
6398 bmode = pf->first_sw->bridge_mode; in ice_bridge_getlink()
6459 * hooked up to. Iterates through the PF VSI list and sets the loopback mode (if
6469 struct ice_pf *pf = np->vsi->back; in ice_bridge_setlink() local
6471 struct ice_hw *hw = &pf->hw; in ice_bridge_setlink()
6476 pf_sw = pf->first_sw; in ice_bridge_setlink()
6491 /* Iterates through the PF VSI list and update the loopback in ice_bridge_setlink()
6494 ice_for_each_vsi(pf, v) { in ice_bridge_setlink()
6495 if (!pf->vsi[v]) in ice_bridge_setlink()
6497 err = ice_vsi_update_bridge_mode(pf->vsi[v], mode); in ice_bridge_setlink()
6532 struct ice_pf *pf = vsi->back; in ice_tx_timeout() local
6535 pf->tx_timeout_count++; in ice_tx_timeout()
6541 if (ice_is_pfc_causing_hung_q(pf, txqueue)) { in ice_tx_timeout()
6542 dev_info(ice_pf_to_dev(pf), "Fake Tx hang detected on queue %u, timeout caused by PFC storm\n", in ice_tx_timeout()
6558 if (time_after(jiffies, (pf->tx_timeout_last_recovery + HZ * 20))) in ice_tx_timeout()
6559 pf->tx_timeout_recovery_level = 1; in ice_tx_timeout()
6560 else if (time_before(jiffies, (pf->tx_timeout_last_recovery + in ice_tx_timeout()
6565 struct ice_hw *hw = &pf->hw; in ice_tx_timeout()
6578 pf->tx_timeout_last_recovery = jiffies; in ice_tx_timeout()
6580 pf->tx_timeout_recovery_level, txqueue); in ice_tx_timeout()
6582 switch (pf->tx_timeout_recovery_level) { in ice_tx_timeout()
6584 set_bit(__ICE_PFR_REQ, pf->state); in ice_tx_timeout()
6587 set_bit(__ICE_CORER_REQ, pf->state); in ice_tx_timeout()
6590 set_bit(__ICE_GLOBR_REQ, pf->state); in ice_tx_timeout()
6594 set_bit(__ICE_DOWN, pf->state); in ice_tx_timeout()
6596 set_bit(__ICE_SERVICE_DIS, pf->state); in ice_tx_timeout()
6600 ice_service_task_schedule(pf); in ice_tx_timeout()
6601 pf->tx_timeout_recovery_level++; in ice_tx_timeout()
6620 struct ice_pf *pf = vsi->back; in ice_open() local
6624 if (test_bit(__ICE_NEEDS_RESTART, pf->state)) { in ice_open()
6629 if (test_bit(__ICE_DOWN, pf->state)) { in ice_open()
6646 clear_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_open()
6647 if (!test_bit(__ICE_PHY_INIT_COMPLETE, pf->state)) { in ice_open()
6663 set_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_open()