Lines Matching full:pf

65 	struct ice_pf *pf = container_of(hw, struct ice_pf, hw);  in ice_hw_to_dev()  local
67 return &pf->pdev->dev; in ice_hw_to_dev()
75 static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type);
77 static void ice_vsi_release_all(struct ice_pf *pf);
79 static int ice_rebuild_channels(struct ice_pf *pf);
113 * @pf: pointer to PF struct
115 static void ice_check_for_hang_subtask(struct ice_pf *pf) in ice_check_for_hang_subtask() argument
123 ice_for_each_vsi(pf, v) in ice_check_for_hang_subtask()
124 if (pf->vsi[v] && pf->vsi[v]->type == ICE_VSI_PF) { in ice_check_for_hang_subtask()
125 vsi = pf->vsi[v]; in ice_check_for_hang_subtask()
177 * @pf: board private structure
179 * Set initial set of MAC filters for PF VSI; configure filters for permanent
183 static int ice_init_mac_fltr(struct ice_pf *pf) in ice_init_mac_fltr() argument
188 vsi = ice_get_main_vsi(pf); in ice_init_mac_fltr()
261 * ice_set_promisc - Enable promiscuous mode for a given PF
290 * ice_clear_promisc - Disable promiscuous mode for a given PF
328 struct ice_pf *pf = vsi->back; in ice_vsi_sync_fltr() local
329 struct ice_hw *hw = &pf->hw; in ice_vsi_sync_fltr()
483 * @pf: board private structure
485 static void ice_sync_fltr_subtask(struct ice_pf *pf) in ice_sync_fltr_subtask() argument
489 if (!pf || !(test_bit(ICE_FLAG_FLTR_SYNC, pf->flags))) in ice_sync_fltr_subtask()
492 clear_bit(ICE_FLAG_FLTR_SYNC, pf->flags); in ice_sync_fltr_subtask()
494 ice_for_each_vsi(pf, v) in ice_sync_fltr_subtask()
495 if (pf->vsi[v] && ice_vsi_fltr_changed(pf->vsi[v]) && in ice_sync_fltr_subtask()
496 ice_vsi_sync_fltr(pf->vsi[v])) { in ice_sync_fltr_subtask()
498 set_bit(ICE_FLAG_FLTR_SYNC, pf->flags); in ice_sync_fltr_subtask()
504 * ice_pf_dis_all_vsi - Pause all VSIs on a PF
505 * @pf: the PF
508 static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked) in ice_pf_dis_all_vsi() argument
513 ice_for_each_vsi(pf, v) in ice_pf_dis_all_vsi()
514 if (pf->vsi[v]) in ice_pf_dis_all_vsi()
515 ice_dis_vsi(pf->vsi[v], locked); in ice_pf_dis_all_vsi()
518 pf->pf_agg_node[node].num_vsis = 0; in ice_pf_dis_all_vsi()
521 pf->vf_agg_node[node].num_vsis = 0; in ice_pf_dis_all_vsi()
526 * @pf: board private structure
532 ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type) in ice_prepare_for_reset() argument
534 struct ice_hw *hw = &pf->hw; in ice_prepare_for_reset()
539 dev_dbg(ice_pf_to_dev(pf), "reset_type=%d\n", reset_type); in ice_prepare_for_reset()
542 if (test_bit(ICE_PREPARED_FOR_RESET, pf->state)) in ice_prepare_for_reset()
545 synchronize_irq(pf->oicr_irq.virq); in ice_prepare_for_reset()
547 ice_unplug_aux_dev(pf); in ice_prepare_for_reset()
551 ice_vc_notify_reset(pf); in ice_prepare_for_reset()
554 mutex_lock(&pf->vfs.table_lock); in ice_prepare_for_reset()
555 ice_for_each_vf(pf, bkt, vf) in ice_prepare_for_reset()
557 mutex_unlock(&pf->vfs.table_lock); in ice_prepare_for_reset()
559 if (ice_is_eswitch_mode_switchdev(pf)) { in ice_prepare_for_reset()
561 ice_eswitch_br_fdb_flush(pf->eswitch.br_offloads->bridge); in ice_prepare_for_reset()
566 vsi = ice_get_main_vsi(pf); in ice_prepare_for_reset()
575 if (test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) { in ice_prepare_for_reset()
591 clear_bit(ICE_FLAG_TC_MQPRIO, pf->flags); in ice_prepare_for_reset()
603 set_bit(ICE_VSI_REBUILD_PENDING, ice_get_main_vsi(pf)->state); in ice_prepare_for_reset()
604 ice_pf_dis_all_vsi(pf, false); in ice_prepare_for_reset()
606 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) in ice_prepare_for_reset()
607 ice_ptp_prepare_for_reset(pf, reset_type); in ice_prepare_for_reset()
609 if (ice_is_feature_supported(pf, ICE_F_GNSS)) in ice_prepare_for_reset()
610 ice_gnss_exit(pf); in ice_prepare_for_reset()
617 set_bit(ICE_PREPARED_FOR_RESET, pf->state); in ice_prepare_for_reset()
622 * @pf: board private structure
625 static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type) in ice_do_reset() argument
627 struct device *dev = ice_pf_to_dev(pf); in ice_do_reset()
628 struct ice_hw *hw = &pf->hw; in ice_do_reset()
632 if (pf->lag && pf->lag->bonded && reset_type == ICE_RESET_PFR) { in ice_do_reset()
637 ice_prepare_for_reset(pf, reset_type); in ice_do_reset()
642 set_bit(ICE_RESET_FAILED, pf->state); in ice_do_reset()
643 clear_bit(ICE_RESET_OICR_RECV, pf->state); in ice_do_reset()
644 clear_bit(ICE_PREPARED_FOR_RESET, pf->state); in ice_do_reset()
645 clear_bit(ICE_PFR_REQ, pf->state); in ice_do_reset()
646 clear_bit(ICE_CORER_REQ, pf->state); in ice_do_reset()
647 clear_bit(ICE_GLOBR_REQ, pf->state); in ice_do_reset()
648 wake_up(&pf->reset_wait_queue); in ice_do_reset()
657 pf->pfr_count++; in ice_do_reset()
658 ice_rebuild(pf, reset_type); in ice_do_reset()
659 clear_bit(ICE_PREPARED_FOR_RESET, pf->state); in ice_do_reset()
660 clear_bit(ICE_PFR_REQ, pf->state); in ice_do_reset()
661 wake_up(&pf->reset_wait_queue); in ice_do_reset()
662 ice_reset_all_vfs(pf); in ice_do_reset()
668 * @pf: board private structure
670 static void ice_reset_subtask(struct ice_pf *pf) in ice_reset_subtask() argument
676 * of reset is pending and sets bits in pf->state indicating the reset in ice_reset_subtask()
678 * prepare for pending reset if not already (for PF software-initiated in ice_reset_subtask()
684 if (test_bit(ICE_RESET_OICR_RECV, pf->state)) { in ice_reset_subtask()
686 if (test_and_clear_bit(ICE_CORER_RECV, pf->state)) in ice_reset_subtask()
688 if (test_and_clear_bit(ICE_GLOBR_RECV, pf->state)) in ice_reset_subtask()
690 if (test_and_clear_bit(ICE_EMPR_RECV, pf->state)) in ice_reset_subtask()
695 ice_prepare_for_reset(pf, reset_type); in ice_reset_subtask()
698 if (ice_check_reset(&pf->hw)) { in ice_reset_subtask()
699 set_bit(ICE_RESET_FAILED, pf->state); in ice_reset_subtask()
702 pf->hw.reset_ongoing = false; in ice_reset_subtask()
703 ice_rebuild(pf, reset_type); in ice_reset_subtask()
707 clear_bit(ICE_RESET_OICR_RECV, pf->state); in ice_reset_subtask()
708 clear_bit(ICE_PREPARED_FOR_RESET, pf->state); in ice_reset_subtask()
709 clear_bit(ICE_PFR_REQ, pf->state); in ice_reset_subtask()
710 clear_bit(ICE_CORER_REQ, pf->state); in ice_reset_subtask()
711 clear_bit(ICE_GLOBR_REQ, pf->state); in ice_reset_subtask()
712 wake_up(&pf->reset_wait_queue); in ice_reset_subtask()
713 ice_reset_all_vfs(pf); in ice_reset_subtask()
720 if (test_bit(ICE_PFR_REQ, pf->state)) { in ice_reset_subtask()
722 if (pf->lag && pf->lag->bonded) { in ice_reset_subtask()
723 dev_dbg(ice_pf_to_dev(pf), "PFR on a bonded interface, promoting to CORER\n"); in ice_reset_subtask()
727 if (test_bit(ICE_CORER_REQ, pf->state)) in ice_reset_subtask()
729 if (test_bit(ICE_GLOBR_REQ, pf->state)) in ice_reset_subtask()
736 if (!test_bit(ICE_DOWN, pf->state) && in ice_reset_subtask()
737 !test_bit(ICE_CFG_BUSY, pf->state)) { in ice_reset_subtask()
738 ice_do_reset(pf, reset_type); in ice_reset_subtask()
934 * @pf: private PF struct
943 static void ice_set_dflt_mib(struct ice_pf *pf) in ice_set_dflt_mib() argument
945 struct device *dev = ice_pf_to_dev(pf); in ice_set_dflt_mib()
949 struct ice_hw *hw = &pf->hw; in ice_set_dflt_mib()
1022 * @pf: pointer to PF struct
1027 static void ice_check_phy_fw_load(struct ice_pf *pf, u8 link_cfg_err) in ice_check_phy_fw_load() argument
1030 clear_bit(ICE_FLAG_PHY_FW_LOAD_FAILED, pf->flags); in ice_check_phy_fw_load()
1034 if (test_bit(ICE_FLAG_PHY_FW_LOAD_FAILED, pf->flags)) in ice_check_phy_fw_load()
1038 …dev_err(ice_pf_to_dev(pf), "Device failed to load the FW for the external PHY. Please download and… in ice_check_phy_fw_load()
1039 set_bit(ICE_FLAG_PHY_FW_LOAD_FAILED, pf->flags); in ice_check_phy_fw_load()
1045 * @pf: pointer to PF struct
1051 static void ice_check_module_power(struct ice_pf *pf, u8 link_cfg_err) in ice_check_module_power() argument
1056 clear_bit(ICE_FLAG_MOD_POWER_UNSUPPORTED, pf->flags); in ice_check_module_power()
1063 if (test_bit(ICE_FLAG_MOD_POWER_UNSUPPORTED, pf->flags)) in ice_check_module_power()
1067 …dev_err(ice_pf_to_dev(pf), "The installed module is incompatible with the device's NVM image. Cann… in ice_check_module_power()
1068 set_bit(ICE_FLAG_MOD_POWER_UNSUPPORTED, pf->flags); in ice_check_module_power()
1070 …dev_err(ice_pf_to_dev(pf), "The module's power requirements exceed the device's power supply. Cann… in ice_check_module_power()
1071 set_bit(ICE_FLAG_MOD_POWER_UNSUPPORTED, pf->flags); in ice_check_module_power()
1077 * @pf: pointer to the PF struct
1083 static void ice_check_link_cfg_err(struct ice_pf *pf, u8 link_cfg_err) in ice_check_link_cfg_err() argument
1085 ice_check_module_power(pf, link_cfg_err); in ice_check_link_cfg_err()
1086 ice_check_phy_fw_load(pf, link_cfg_err); in ice_check_link_cfg_err()
1091 * @pf: PF that the link event is associated with
1099 ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up, in ice_link_event() argument
1102 struct device *dev = ice_pf_to_dev(pf); in ice_link_event()
1124 ice_check_link_cfg_err(pf, pi->phy.link_info.link_cfg_err); in ice_link_event()
1132 vsi = ice_get_main_vsi(pf); in ice_link_event()
1137 if (!test_bit(ICE_FLAG_NO_MEDIA, pf->flags) && in ice_link_event()
1139 set_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_link_event()
1147 ice_ptp_link_change(pf, pf->hw.pf_id, link_up); in ice_link_event()
1149 if (ice_is_dcb_active(pf)) { in ice_link_event()
1150 if (test_bit(ICE_FLAG_DCB_ENA, pf->flags)) in ice_link_event()
1151 ice_dcb_rebuild(pf); in ice_link_event()
1154 ice_set_dflt_mib(pf); in ice_link_event()
1159 ice_vc_notify_link_state(pf); in ice_link_event()
1166 * @pf: board private structure
1168 static void ice_watchdog_subtask(struct ice_pf *pf) in ice_watchdog_subtask() argument
1173 if (test_bit(ICE_DOWN, pf->state) || in ice_watchdog_subtask()
1174 test_bit(ICE_CFG_BUSY, pf->state)) in ice_watchdog_subtask()
1179 pf->serv_tmr_prev + pf->serv_tmr_period)) in ice_watchdog_subtask()
1182 pf->serv_tmr_prev = jiffies; in ice_watchdog_subtask()
1187 ice_update_pf_stats(pf); in ice_watchdog_subtask()
1188 ice_for_each_vsi(pf, i) in ice_watchdog_subtask()
1189 if (pf->vsi[i] && pf->vsi[i]->netdev) in ice_watchdog_subtask()
1190 ice_update_vsi_stats(pf->vsi[i]); in ice_watchdog_subtask()
1224 * @pf: PF that the link event is associated with
1228 ice_handle_link_event(struct ice_pf *pf, struct ice_rq_event_info *event) in ice_handle_link_event() argument
1235 port_info = pf->hw.port_info; in ice_handle_link_event()
1239 status = ice_link_event(pf, port_info, in ice_handle_link_event()
1243 dev_dbg(ice_pf_to_dev(pf), "Could not process link event, error %d\n", in ice_handle_link_event()
1251 * @pf: PF that the FW log event is associated with
1255 ice_get_fwlog_data(struct ice_pf *pf, struct ice_rq_event_info *event) in ice_get_fwlog_data() argument
1258 struct ice_hw *hw = &pf->hw; in ice_get_fwlog_data()
1277 * @pf: pointer to the PF private structure
1282 * a given PF. Actual wait would be done by a call to ice_aq_wait_for_event().
1291 void ice_aq_prep_for_event(struct ice_pf *pf, struct ice_aq_task *task, in ice_aq_prep_for_event() argument
1298 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_prep_for_event()
1299 hlist_add_head(&task->entry, &pf->aq_wait_list); in ice_aq_prep_for_event()
1300 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_prep_for_event()
1305 * @pf: pointer to the PF private structure
1309 * Waits for a specific AdminQ completion event on the ARQ for a given PF. The
1315 int ice_aq_wait_for_event(struct ice_pf *pf, struct ice_aq_task *task, in ice_aq_wait_for_event() argument
1319 struct device *dev = ice_pf_to_dev(pf); in ice_aq_wait_for_event()
1324 ret = wait_event_interruptible_timeout(pf->aq_wait_queue, in ice_aq_wait_for_event()
1352 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1354 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1361 * @pf: pointer to the PF private structure
1377 static void ice_aq_check_events(struct ice_pf *pf, u16 opcode, in ice_aq_check_events() argument
1384 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_check_events()
1385 hlist_for_each_entry(task, &pf->aq_wait_list, entry) { in ice_aq_check_events()
1405 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_check_events()
1408 wake_up(&pf->aq_wait_queue); in ice_aq_check_events()
1413 * @pf: the PF private structure
1418 static void ice_aq_cancel_waiting_tasks(struct ice_pf *pf) in ice_aq_cancel_waiting_tasks() argument
1422 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_cancel_waiting_tasks()
1423 hlist_for_each_entry(task, &pf->aq_wait_list, entry) in ice_aq_cancel_waiting_tasks()
1425 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_cancel_waiting_tasks()
1427 wake_up(&pf->aq_wait_queue); in ice_aq_cancel_waiting_tasks()
1434 * @pf: ptr to struct ice_pf
1437 static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type) in __ice_clean_ctrlq() argument
1439 struct device *dev = ice_pf_to_dev(pf); in __ice_clean_ctrlq()
1441 struct ice_hw *hw = &pf->hw; in __ice_clean_ctrlq()
1447 /* Do not clean control queue if/when PF reset fails */ in __ice_clean_ctrlq()
1448 if (test_bit(ICE_RESET_FAILED, pf->state)) in __ice_clean_ctrlq()
1538 ice_aq_check_events(pf, opcode, &event); in __ice_clean_ctrlq()
1542 if (ice_handle_link_event(pf, &event)) in __ice_clean_ctrlq()
1546 ice_vf_lan_overflow_event(pf, &event); in __ice_clean_ctrlq()
1549 if (ice_is_feature_supported(pf, ICE_F_MBX_LIMIT)) { in __ice_clean_ctrlq()
1550 ice_vc_process_vf_msg(pf, &event, NULL); in __ice_clean_ctrlq()
1561 ice_vc_process_vf_msg(pf, &event, &data); in __ice_clean_ctrlq()
1565 ice_get_fwlog_data(pf, &event); in __ice_clean_ctrlq()
1568 ice_dcb_process_lldp_set_mib_change(pf, &event); in __ice_clean_ctrlq()
1599 * @pf: board private structure
1601 static void ice_clean_adminq_subtask(struct ice_pf *pf) in ice_clean_adminq_subtask() argument
1603 struct ice_hw *hw = &pf->hw; in ice_clean_adminq_subtask()
1605 if (!test_bit(ICE_ADMINQ_EVENT_PENDING, pf->state)) in ice_clean_adminq_subtask()
1608 if (__ice_clean_ctrlq(pf, ICE_CTL_Q_ADMIN)) in ice_clean_adminq_subtask()
1611 clear_bit(ICE_ADMINQ_EVENT_PENDING, pf->state); in ice_clean_adminq_subtask()
1619 __ice_clean_ctrlq(pf, ICE_CTL_Q_ADMIN); in ice_clean_adminq_subtask()
1626 * @pf: board private structure
1628 static void ice_clean_mailboxq_subtask(struct ice_pf *pf) in ice_clean_mailboxq_subtask() argument
1630 struct ice_hw *hw = &pf->hw; in ice_clean_mailboxq_subtask()
1632 if (!test_bit(ICE_MAILBOXQ_EVENT_PENDING, pf->state)) in ice_clean_mailboxq_subtask()
1635 if (__ice_clean_ctrlq(pf, ICE_CTL_Q_MAILBOX)) in ice_clean_mailboxq_subtask()
1638 clear_bit(ICE_MAILBOXQ_EVENT_PENDING, pf->state); in ice_clean_mailboxq_subtask()
1641 __ice_clean_ctrlq(pf, ICE_CTL_Q_MAILBOX); in ice_clean_mailboxq_subtask()
1648 * @pf: board private structure
1650 static void ice_clean_sbq_subtask(struct ice_pf *pf) in ice_clean_sbq_subtask() argument
1652 struct ice_hw *hw = &pf->hw; in ice_clean_sbq_subtask()
1658 clear_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state); in ice_clean_sbq_subtask()
1662 if (!test_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state)) in ice_clean_sbq_subtask()
1665 if (__ice_clean_ctrlq(pf, ICE_CTL_Q_SB)) in ice_clean_sbq_subtask()
1668 clear_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state); in ice_clean_sbq_subtask()
1671 __ice_clean_ctrlq(pf, ICE_CTL_Q_SB); in ice_clean_sbq_subtask()
1678 * @pf: board private structure
1682 void ice_service_task_schedule(struct ice_pf *pf) in ice_service_task_schedule() argument
1684 if (!test_bit(ICE_SERVICE_DIS, pf->state) && in ice_service_task_schedule()
1685 !test_and_set_bit(ICE_SERVICE_SCHED, pf->state) && in ice_service_task_schedule()
1686 !test_bit(ICE_NEEDS_RESTART, pf->state)) in ice_service_task_schedule()
1687 queue_work(ice_wq, &pf->serv_task); in ice_service_task_schedule()
1692 * @pf: board private structure
1694 static void ice_service_task_complete(struct ice_pf *pf) in ice_service_task_complete() argument
1696 WARN_ON(!test_bit(ICE_SERVICE_SCHED, pf->state)); in ice_service_task_complete()
1698 /* force memory (pf->state) to sync before next service task */ in ice_service_task_complete()
1700 clear_bit(ICE_SERVICE_SCHED, pf->state); in ice_service_task_complete()
1705 * @pf: board private structure
1710 static int ice_service_task_stop(struct ice_pf *pf) in ice_service_task_stop() argument
1714 ret = test_and_set_bit(ICE_SERVICE_DIS, pf->state); in ice_service_task_stop()
1716 if (pf->serv_tmr.function) in ice_service_task_stop()
1717 del_timer_sync(&pf->serv_tmr); in ice_service_task_stop()
1718 if (pf->serv_task.func) in ice_service_task_stop()
1719 cancel_work_sync(&pf->serv_task); in ice_service_task_stop()
1721 clear_bit(ICE_SERVICE_SCHED, pf->state); in ice_service_task_stop()
1727 * @pf: board private structure
1731 static void ice_service_task_restart(struct ice_pf *pf) in ice_service_task_restart() argument
1733 clear_bit(ICE_SERVICE_DIS, pf->state); in ice_service_task_restart()
1734 ice_service_task_schedule(pf); in ice_service_task_restart()
1743 struct ice_pf *pf = from_timer(pf, t, serv_tmr); in ice_service_timer() local
1745 mod_timer(&pf->serv_tmr, round_jiffies(pf->serv_tmr_period + jiffies)); in ice_service_timer()
1746 ice_service_task_schedule(pf); in ice_service_timer()
1751 * @pf: pointer to the PF structure
1756 * Since the queue can get stuck on VF MDD events, the PF can be configured to
1760 static void ice_mdd_maybe_reset_vf(struct ice_pf *pf, struct ice_vf *vf, in ice_mdd_maybe_reset_vf() argument
1763 struct device *dev = ice_pf_to_dev(pf); in ice_mdd_maybe_reset_vf()
1765 if (!test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)) in ice_mdd_maybe_reset_vf()
1777 dev_info(dev, "PF-to-VF reset on PF %d VF %d due to MDD event\n", in ice_mdd_maybe_reset_vf()
1778 pf->hw.pf_id, vf->vf_id); in ice_mdd_maybe_reset_vf()
1784 * @pf: pointer to the PF structure
1787 * VF MDD logging is guarded by net_ratelimit. Additional PF and VF log
1789 * disable the queue, the PF can be configured to reset the VF using ethtool
1792 static void ice_handle_mdd_event(struct ice_pf *pf) in ice_handle_mdd_event() argument
1794 struct device *dev = ice_pf_to_dev(pf); in ice_handle_mdd_event()
1795 struct ice_hw *hw = &pf->hw; in ice_handle_mdd_event()
1800 if (!test_and_clear_bit(ICE_MDD_EVENT_PENDING, pf->state)) { in ice_handle_mdd_event()
1804 ice_print_vfs_mdd_events(pf); in ice_handle_mdd_event()
1816 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1817 dev_info(dev, "Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\n", in ice_handle_mdd_event()
1829 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1830 dev_info(dev, "Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\n", in ice_handle_mdd_event()
1842 if (netif_msg_rx_err(pf)) in ice_handle_mdd_event()
1843 dev_info(dev, "Malicious Driver Detection event %d on RX queue %d PF# %d VF# %d\n", in ice_handle_mdd_event()
1848 /* check to see if this PF caused an MDD event */ in ice_handle_mdd_event()
1852 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1853 dev_info(dev, "Malicious Driver Detection event TX_PQM detected on PF\n"); in ice_handle_mdd_event()
1859 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1860 dev_info(dev, "Malicious Driver Detection event TX_TCLAN detected on PF\n"); in ice_handle_mdd_event()
1866 if (netif_msg_rx_err(pf)) in ice_handle_mdd_event()
1867 dev_info(dev, "Malicious Driver Detection event RX detected on PF\n"); in ice_handle_mdd_event()
1873 mutex_lock(&pf->vfs.table_lock); in ice_handle_mdd_event()
1874 ice_for_each_vf(pf, bkt, vf) { in ice_handle_mdd_event()
1881 set_bit(ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1882 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1893 set_bit(ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1894 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1905 set_bit(ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1906 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1917 set_bit(ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1918 if (netif_msg_rx_err(pf)) in ice_handle_mdd_event()
1926 ice_mdd_maybe_reset_vf(pf, vf, reset_vf_tx, in ice_handle_mdd_event()
1929 mutex_unlock(&pf->vfs.table_lock); in ice_handle_mdd_event()
1931 ice_print_vfs_mdd_events(pf); in ice_handle_mdd_event()
2019 struct ice_pf *pf = pi->hw->back; in ice_init_nvm_phy_type() local
2030 dev_err(ice_pf_to_dev(pf), "Get PHY capability failed.\n"); in ice_init_nvm_phy_type()
2034 pf->nvm_phy_type_hi = pcaps->phy_type_high; in ice_init_nvm_phy_type()
2035 pf->nvm_phy_type_lo = pcaps->phy_type_low; in ice_init_nvm_phy_type()
2051 struct ice_pf *pf = pi->hw->back; in ice_init_link_dflt_override() local
2053 ldo = &pf->link_dflt_override; in ice_init_link_dflt_override()
2063 set_bit(ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA, pf->flags); in ice_init_link_dflt_override()
2064 set_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags); in ice_init_link_dflt_override()
2089 struct ice_pf *pf = pi->hw->back; in ice_init_phy_cfg_dflt_override() local
2091 ldo = &pf->link_dflt_override; in ice_init_phy_cfg_dflt_override()
2099 cfg->phy_type_low = pf->nvm_phy_type_lo & in ice_init_phy_cfg_dflt_override()
2101 cfg->phy_type_high = pf->nvm_phy_type_hi & in ice_init_phy_cfg_dflt_override()
2107 set_bit(ICE_LINK_DEFAULT_OVERRIDE_PENDING, pf->state); in ice_init_phy_cfg_dflt_override()
2128 struct ice_pf *pf = pi->hw->back; in ice_init_phy_user_cfg() local
2145 dev_err(ice_pf_to_dev(pf), "Get PHY capability failed.\n"); in ice_init_phy_user_cfg()
2155 set_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags); in ice_init_phy_user_cfg()
2162 (pf->link_dflt_override.options & ICE_LINK_OVERRIDE_EN)) { in ice_init_phy_user_cfg()
2177 set_bit(ICE_PHY_INIT_COMPLETE, pf->state); in ice_init_phy_user_cfg()
2198 struct ice_pf *pf = vsi->back; in ice_configure_phy() local
2207 if (!test_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags) && in ice_configure_phy()
2211 if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags)) in ice_configure_phy()
2297 err = ice_aq_set_phy_cfg(&pf->hw, pi, cfg, NULL); in ice_configure_phy()
2310 * @pf: pointer to PF struct
2315 static void ice_check_media_subtask(struct ice_pf *pf) in ice_check_media_subtask() argument
2322 if (!test_bit(ICE_FLAG_NO_MEDIA, pf->flags)) in ice_check_media_subtask()
2325 vsi = ice_get_main_vsi(pf); in ice_check_media_subtask()
2335 ice_check_link_cfg_err(pf, pi->phy.link_info.link_cfg_err); in ice_check_media_subtask()
2338 if (!test_bit(ICE_PHY_INIT_COMPLETE, pf->state)) in ice_check_media_subtask()
2350 clear_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_check_media_subtask()
2360 * @work: pointer to work_struct contained by the PF struct
2364 struct ice_pf *pf = container_of(work, struct ice_pf, serv_task); in ice_service_task() local
2370 ice_reset_subtask(pf); in ice_service_task()
2373 if (ice_is_reset_in_progress(pf->state) || in ice_service_task()
2374 test_bit(ICE_SUSPENDED, pf->state) || in ice_service_task()
2375 test_bit(ICE_NEEDS_RESTART, pf->state)) { in ice_service_task()
2376 ice_service_task_complete(pf); in ice_service_task()
2380 if (test_and_clear_bit(ICE_AUX_ERR_PENDING, pf->state)) { in ice_service_task()
2387 swap(event->reg, pf->oicr_err_reg); in ice_service_task()
2388 ice_send_event_to_aux(pf, event); in ice_service_task()
2396 if (test_and_clear_bit(ICE_FLAG_UNPLUG_AUX_DEV, pf->flags)) in ice_service_task()
2397 ice_unplug_aux_dev(pf); in ice_service_task()
2400 if (test_and_clear_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags)) in ice_service_task()
2401 ice_plug_aux_dev(pf); in ice_service_task()
2403 if (test_and_clear_bit(ICE_FLAG_MTU_CHANGED, pf->flags)) { in ice_service_task()
2409 ice_send_event_to_aux(pf, event); in ice_service_task()
2414 ice_clean_adminq_subtask(pf); in ice_service_task()
2415 ice_check_media_subtask(pf); in ice_service_task()
2416 ice_check_for_hang_subtask(pf); in ice_service_task()
2417 ice_sync_fltr_subtask(pf); in ice_service_task()
2418 ice_handle_mdd_event(pf); in ice_service_task()
2419 ice_watchdog_subtask(pf); in ice_service_task()
2421 if (ice_is_safe_mode(pf)) { in ice_service_task()
2422 ice_service_task_complete(pf); in ice_service_task()
2426 ice_process_vflr_event(pf); in ice_service_task()
2427 ice_clean_mailboxq_subtask(pf); in ice_service_task()
2428 ice_clean_sbq_subtask(pf); in ice_service_task()
2429 ice_sync_arfs_fltrs(pf); in ice_service_task()
2430 ice_flush_fdir_ctx(pf); in ice_service_task()
2433 ice_service_task_complete(pf); in ice_service_task()
2439 if (time_after(jiffies, (start_time + pf->serv_tmr_period)) || in ice_service_task()
2440 test_bit(ICE_MDD_EVENT_PENDING, pf->state) || in ice_service_task()
2441 test_bit(ICE_VFLR_EVENT_PENDING, pf->state) || in ice_service_task()
2442 test_bit(ICE_MAILBOXQ_EVENT_PENDING, pf->state) || in ice_service_task()
2443 test_bit(ICE_FD_VF_FLUSH_CTX, pf->state) || in ice_service_task()
2444 test_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state) || in ice_service_task()
2445 test_bit(ICE_ADMINQ_EVENT_PENDING, pf->state)) in ice_service_task()
2446 mod_timer(&pf->serv_tmr, jiffies); in ice_service_task()
2471 * @pf: board private structure
2474 int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset) in ice_schedule_reset() argument
2476 struct device *dev = ice_pf_to_dev(pf); in ice_schedule_reset()
2479 if (test_bit(ICE_RESET_FAILED, pf->state)) { in ice_schedule_reset()
2484 if (ice_is_reset_in_progress(pf->state)) { in ice_schedule_reset()
2491 set_bit(ICE_PFR_REQ, pf->state); in ice_schedule_reset()
2494 set_bit(ICE_CORER_REQ, pf->state); in ice_schedule_reset()
2497 set_bit(ICE_GLOBR_REQ, pf->state); in ice_schedule_reset()
2503 ice_service_task_schedule(pf); in ice_schedule_reset()
2559 struct ice_pf *pf = vsi->back; in ice_vsi_req_irq_msix() local
2566 dev = ice_pf_to_dev(pf); in ice_vsi_req_irq_msix()
2776 struct ice_pf *pf = vsi->back; in ice_prepare_xdp_rings() local
2778 .qs_mutex = &pf->avail_q_mutex, in ice_prepare_xdp_rings()
2779 .pf_map = pf->avail_txqs, in ice_prepare_xdp_rings()
2780 .pf_map_size = pf->max_pf_txqs, in ice_prepare_xdp_rings()
2790 dev = ice_pf_to_dev(pf); in ice_prepare_xdp_rings()
2851 mutex_lock(&pf->avail_q_mutex); in ice_prepare_xdp_rings()
2853 clear_bit(vsi->txq_map[i + vsi->alloc_txq], pf->avail_txqs); in ice_prepare_xdp_rings()
2856 mutex_unlock(&pf->avail_q_mutex); in ice_prepare_xdp_rings()
2867 * Detach XDP rings from irq vectors, clean up the PF bitmap and free
2873 struct ice_pf *pf = vsi->back; in ice_destroy_xdp_rings() local
2895 mutex_lock(&pf->avail_q_mutex); in ice_destroy_xdp_rings()
2897 clear_bit(vsi->txq_map[i + vsi->alloc_txq], pf->avail_txqs); in ice_destroy_xdp_rings()
2900 mutex_unlock(&pf->avail_q_mutex); in ice_destroy_xdp_rings()
2914 devm_kfree(ice_pf_to_dev(pf), vsi->xdp_rings); in ice_destroy_xdp_rings()
3094 NL_SET_ERR_MSG_MOD(xdp->extack, "XDP can be loaded only on PF or SF VSI"); in ice_xdp()
3117 * @pf: board private structure
3119 static void ice_ena_misc_vector(struct ice_pf *pf) in ice_ena_misc_vector() argument
3121 struct ice_hw *hw = &pf->hw; in ice_ena_misc_vector()
3149 wr32(hw, GLINT_DYN_CTL(pf->oicr_irq.index), in ice_ena_misc_vector()
3152 if (!pf->hw.dev_caps.ts_dev_info.ts_ll_int_read) in ice_ena_misc_vector()
3155 wr32(hw, GLINT_DYN_CTL(pf->ll_ts_irq.index + pf_intr_start_offset), in ice_ena_misc_vector()
3166 struct ice_pf *pf = data; in ice_ll_ts_intr() local
3174 hw = &pf->hw; in ice_ll_ts_intr()
3175 tx = &pf->ptp.port.tx; in ice_ll_ts_intr()
3188 wr32(hw, GLINT_DYN_CTL(pf->ll_ts_irq.index + pf_intr_start_offset), in ice_ll_ts_intr()
3201 struct ice_pf *pf = (struct ice_pf *)data; in ice_misc_intr() local
3203 struct ice_hw *hw = &pf->hw; in ice_misc_intr()
3207 dev = ice_pf_to_dev(pf); in ice_misc_intr()
3208 set_bit(ICE_ADMINQ_EVENT_PENDING, pf->state); in ice_misc_intr()
3209 set_bit(ICE_MAILBOXQ_EVENT_PENDING, pf->state); in ice_misc_intr()
3210 set_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state); in ice_misc_intr()
3217 pf->sw_int_count++; in ice_misc_intr()
3222 set_bit(ICE_MDD_EVENT_PENDING, pf->state); in ice_misc_intr()
3226 if (test_bit(ICE_VF_RESETS_DISABLED, pf->state)) { in ice_misc_intr()
3233 set_bit(ICE_VFLR_EVENT_PENDING, pf->state); in ice_misc_intr()
3246 pf->corer_count++; in ice_misc_intr()
3248 pf->globr_count++; in ice_misc_intr()
3250 pf->empr_count++; in ice_misc_intr()
3255 * pf->state so that the service task can start a reset/rebuild. in ice_misc_intr()
3257 if (!test_and_set_bit(ICE_RESET_OICR_RECV, pf->state)) { in ice_misc_intr()
3259 set_bit(ICE_CORER_RECV, pf->state); in ice_misc_intr()
3261 set_bit(ICE_GLOBR_RECV, pf->state); in ice_misc_intr()
3263 set_bit(ICE_EMPR_RECV, pf->state); in ice_misc_intr()
3271 * ICE_RESET_OICR_RECV in pf->state indicates in ice_misc_intr()
3284 if (ice_pf_state_is_nominal(pf) && in ice_misc_intr()
3285 pf->hw.dev_caps.ts_dev_info.ts_ll_int_read) { in ice_misc_intr()
3286 struct ice_ptp_tx *tx = &pf->ptp.port.tx; in ice_misc_intr()
3296 } else if (ice_ptp_pf_handles_tx_interrupt(pf)) { in ice_misc_intr()
3297 set_bit(ICE_MISC_THREAD_TX_TSTAMP, pf->misc_thread); in ice_misc_intr()
3308 if (ice_pf_src_tmr_owned(pf)) { in ice_misc_intr()
3310 pf->ptp.ext_ts_irq |= gltsyn_stat & in ice_misc_intr()
3315 ice_ptp_extts_event(pf); in ice_misc_intr()
3321 pf->oicr_err_reg |= oicr; in ice_misc_intr()
3322 set_bit(ICE_AUX_ERR_PENDING, pf->state); in ice_misc_intr()
3335 set_bit(ICE_PFR_REQ, pf->state); in ice_misc_intr()
3338 ice_service_task_schedule(pf); in ice_misc_intr()
3352 struct ice_pf *pf = data; in ice_misc_intr_thread_fn() local
3355 hw = &pf->hw; in ice_misc_intr_thread_fn()
3357 if (ice_is_reset_in_progress(pf->state)) in ice_misc_intr_thread_fn()
3360 if (test_and_clear_bit(ICE_MISC_THREAD_TX_TSTAMP, pf->misc_thread)) { in ice_misc_intr_thread_fn()
3364 if (ice_ptp_process_ts(pf) == ICE_TX_TSTAMP_WORK_PENDING) { in ice_misc_intr_thread_fn()
3402 * @pf: board private structure
3404 static void ice_free_irq_msix_ll_ts(struct ice_pf *pf) in ice_free_irq_msix_ll_ts() argument
3406 int irq_num = pf->ll_ts_irq.virq; in ice_free_irq_msix_ll_ts()
3409 devm_free_irq(ice_pf_to_dev(pf), irq_num, pf); in ice_free_irq_msix_ll_ts()
3411 ice_free_irq(pf, pf->ll_ts_irq); in ice_free_irq_msix_ll_ts()
3416 * @pf: board private structure
3418 static void ice_free_irq_msix_misc(struct ice_pf *pf) in ice_free_irq_msix_misc() argument
3420 int misc_irq_num = pf->oicr_irq.virq; in ice_free_irq_msix_misc()
3421 struct ice_hw *hw = &pf->hw; in ice_free_irq_msix_misc()
3430 devm_free_irq(ice_pf_to_dev(pf), misc_irq_num, pf); in ice_free_irq_msix_misc()
3432 ice_free_irq(pf, pf->oicr_irq); in ice_free_irq_msix_misc()
3433 if (pf->hw.dev_caps.ts_dev_info.ts_ll_int_read) in ice_free_irq_msix_misc()
3434 ice_free_irq_msix_ll_ts(pf); in ice_free_irq_msix_misc()
3472 * @pf: board private structure
3478 static int ice_req_irq_msix_misc(struct ice_pf *pf) in ice_req_irq_msix_misc() argument
3480 struct device *dev = ice_pf_to_dev(pf); in ice_req_irq_msix_misc()
3481 struct ice_hw *hw = &pf->hw; in ice_req_irq_msix_misc()
3486 if (!pf->int_name[0]) in ice_req_irq_msix_misc()
3487 snprintf(pf->int_name, sizeof(pf->int_name) - 1, "%s-%s:misc", in ice_req_irq_msix_misc()
3490 if (!pf->int_name_ll_ts[0]) in ice_req_irq_msix_misc()
3491 snprintf(pf->int_name_ll_ts, sizeof(pf->int_name_ll_ts) - 1, in ice_req_irq_msix_misc()
3497 if (ice_is_reset_in_progress(pf->state)) in ice_req_irq_msix_misc()
3501 irq = ice_alloc_irq(pf, false); in ice_req_irq_msix_misc()
3505 pf->oicr_irq = irq; in ice_req_irq_msix_misc()
3506 err = devm_request_threaded_irq(dev, pf->oicr_irq.virq, ice_misc_intr, in ice_req_irq_msix_misc()
3508 pf->int_name, pf); in ice_req_irq_msix_misc()
3511 pf->int_name, err); in ice_req_irq_msix_misc()
3512 ice_free_irq(pf, pf->oicr_irq); in ice_req_irq_msix_misc()
3517 if (!pf->hw.dev_caps.ts_dev_info.ts_ll_int_read) in ice_req_irq_msix_misc()
3520 irq = ice_alloc_irq(pf, false); in ice_req_irq_msix_misc()
3524 pf->ll_ts_irq = irq; in ice_req_irq_msix_misc()
3525 err = devm_request_irq(dev, pf->ll_ts_irq.virq, ice_ll_ts_intr, 0, in ice_req_irq_msix_misc()
3526 pf->int_name_ll_ts, pf); in ice_req_irq_msix_misc()
3529 pf->int_name_ll_ts, err); in ice_req_irq_msix_misc()
3530 ice_free_irq(pf, pf->ll_ts_irq); in ice_req_irq_msix_misc()
3535 ice_ena_misc_vector(pf); in ice_req_irq_msix_misc()
3537 ice_ena_ctrlq_interrupts(hw, pf->oicr_irq.index); in ice_req_irq_msix_misc()
3540 if (pf->hw.dev_caps.ts_dev_info.ts_ll_int_read) in ice_req_irq_msix_misc()
3542 ((pf->ll_ts_irq.index + pf_intr_start_offset) & in ice_req_irq_msix_misc()
3544 wr32(hw, GLINT_ITR(ICE_RX_ITR, pf->oicr_irq.index), in ice_req_irq_msix_misc()
3560 struct ice_pf *pf = ice_netdev_to_pf(netdev); in ice_set_ops() local
3562 if (ice_is_safe_mode(pf)) { in ice_set_ops()
3569 netdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic; in ice_set_ops()
3588 struct ice_pf *pf = ice_netdev_to_pf(netdev); in ice_set_netdev_features() local
3589 bool is_dvm_ena = ice_is_dvm_ena(&pf->hw); in ice_set_netdev_features()
3595 if (ice_is_safe_mode(pf)) { in ice_set_netdev_features()
3687 * ice_pf_vsi_setup - Set up a PF VSI
3688 * @pf: board private structure
3695 ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_pf_vsi_setup() argument
3703 return ice_vsi_setup(pf, &params); in ice_pf_vsi_setup()
3707 ice_chnl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, in ice_chnl_vsi_setup() argument
3717 return ice_vsi_setup(pf, &params); in ice_chnl_vsi_setup()
3722 * @pf: board private structure
3729 ice_ctrl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_ctrl_vsi_setup() argument
3737 return ice_vsi_setup(pf, &params); in ice_ctrl_vsi_setup()
3742 * @pf: board private structure
3749 ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_lb_vsi_setup() argument
3757 return ice_vsi_setup(pf, &params); in ice_lb_vsi_setup()
3955 * @pf: pointer to an ice_pf instance
3957 u16 ice_get_avail_txq_count(struct ice_pf *pf) in ice_get_avail_txq_count() argument
3959 return ice_get_avail_q_count(pf->avail_txqs, &pf->avail_q_mutex, in ice_get_avail_txq_count()
3960 pf->max_pf_txqs); in ice_get_avail_txq_count()
3965 * @pf: pointer to an ice_pf instance
3967 u16 ice_get_avail_rxq_count(struct ice_pf *pf) in ice_get_avail_rxq_count() argument
3969 return ice_get_avail_q_count(pf->avail_rxqs, &pf->avail_q_mutex, in ice_get_avail_rxq_count()
3970 pf->max_pf_rxqs); in ice_get_avail_rxq_count()
3975 * @pf: board private structure to initialize
3977 static void ice_deinit_pf(struct ice_pf *pf) in ice_deinit_pf() argument
3979 ice_service_task_stop(pf); in ice_deinit_pf()
3980 mutex_destroy(&pf->lag_mutex); in ice_deinit_pf()
3981 mutex_destroy(&pf->adev_mutex); in ice_deinit_pf()
3982 mutex_destroy(&pf->sw_mutex); in ice_deinit_pf()
3983 mutex_destroy(&pf->tc_mutex); in ice_deinit_pf()
3984 mutex_destroy(&pf->avail_q_mutex); in ice_deinit_pf()
3985 mutex_destroy(&pf->vfs.table_lock); in ice_deinit_pf()
3987 if (pf->avail_txqs) { in ice_deinit_pf()
3988 bitmap_free(pf->avail_txqs); in ice_deinit_pf()
3989 pf->avail_txqs = NULL; in ice_deinit_pf()
3992 if (pf->avail_rxqs) { in ice_deinit_pf()
3993 bitmap_free(pf->avail_rxqs); in ice_deinit_pf()
3994 pf->avail_rxqs = NULL; in ice_deinit_pf()
3997 if (pf->ptp.clock) in ice_deinit_pf()
3998 ptp_clock_unregister(pf->ptp.clock); in ice_deinit_pf()
4000 xa_destroy(&pf->dyn_ports); in ice_deinit_pf()
4001 xa_destroy(&pf->sf_nums); in ice_deinit_pf()
4006 * @pf: pointer to the PF instance
4008 static void ice_set_pf_caps(struct ice_pf *pf) in ice_set_pf_caps() argument
4010 struct ice_hw_func_caps *func_caps = &pf->hw.func_caps; in ice_set_pf_caps()
4012 clear_bit(ICE_FLAG_RDMA_ENA, pf->flags); in ice_set_pf_caps()
4014 set_bit(ICE_FLAG_RDMA_ENA, pf->flags); in ice_set_pf_caps()
4015 clear_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); in ice_set_pf_caps()
4017 set_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); in ice_set_pf_caps()
4018 clear_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags); in ice_set_pf_caps()
4020 set_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags); in ice_set_pf_caps()
4021 pf->vfs.num_supported = min_t(int, func_caps->num_allocd_vfs, in ice_set_pf_caps()
4024 clear_bit(ICE_FLAG_RSS_ENA, pf->flags); in ice_set_pf_caps()
4026 set_bit(ICE_FLAG_RSS_ENA, pf->flags); in ice_set_pf_caps()
4028 clear_bit(ICE_FLAG_FD_ENA, pf->flags); in ice_set_pf_caps()
4035 pf->ctrl_vsi_idx = ICE_NO_VSI; in ice_set_pf_caps()
4036 set_bit(ICE_FLAG_FD_ENA, pf->flags); in ice_set_pf_caps()
4037 /* force guaranteed filter pool for PF */ in ice_set_pf_caps()
4038 ice_alloc_fd_guar_item(&pf->hw, &unused, in ice_set_pf_caps()
4040 /* force shared filter pool for PF */ in ice_set_pf_caps()
4041 ice_alloc_fd_shrd_item(&pf->hw, &unused, in ice_set_pf_caps()
4045 clear_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags); in ice_set_pf_caps()
4047 !(pf->hw.mac_type == ICE_MAC_E830)) in ice_set_pf_caps()
4048 set_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags); in ice_set_pf_caps()
4050 pf->max_pf_txqs = func_caps->common_cap.num_txq; in ice_set_pf_caps()
4051 pf->max_pf_rxqs = func_caps->common_cap.num_rxq; in ice_set_pf_caps()
4056 * @pf: board private structure to initialize
4058 static int ice_init_pf(struct ice_pf *pf) in ice_init_pf() argument
4060 ice_set_pf_caps(pf); in ice_init_pf()
4062 mutex_init(&pf->sw_mutex); in ice_init_pf()
4063 mutex_init(&pf->tc_mutex); in ice_init_pf()
4064 mutex_init(&pf->adev_mutex); in ice_init_pf()
4065 mutex_init(&pf->lag_mutex); in ice_init_pf()
4067 INIT_HLIST_HEAD(&pf->aq_wait_list); in ice_init_pf()
4068 spin_lock_init(&pf->aq_wait_lock); in ice_init_pf()
4069 init_waitqueue_head(&pf->aq_wait_queue); in ice_init_pf()
4071 init_waitqueue_head(&pf->reset_wait_queue); in ice_init_pf()
4074 timer_setup(&pf->serv_tmr, ice_service_timer, 0); in ice_init_pf()
4075 pf->serv_tmr_period = HZ; in ice_init_pf()
4076 INIT_WORK(&pf->serv_task, ice_service_task); in ice_init_pf()
4077 clear_bit(ICE_SERVICE_SCHED, pf->state); in ice_init_pf()
4079 mutex_init(&pf->avail_q_mutex); in ice_init_pf()
4080 pf->avail_txqs = bitmap_zalloc(pf->max_pf_txqs, GFP_KERNEL); in ice_init_pf()
4081 if (!pf->avail_txqs) in ice_init_pf()
4084 pf->avail_rxqs = bitmap_zalloc(pf->max_pf_rxqs, GFP_KERNEL); in ice_init_pf()
4085 if (!pf->avail_rxqs) { in ice_init_pf()
4086 bitmap_free(pf->avail_txqs); in ice_init_pf()
4087 pf->avail_txqs = NULL; in ice_init_pf()
4091 mutex_init(&pf->vfs.table_lock); in ice_init_pf()
4092 hash_init(pf->vfs.table); in ice_init_pf()
4093 if (ice_is_feature_supported(pf, ICE_F_MBX_LIMIT)) in ice_init_pf()
4094 wr32(&pf->hw, E830_MBX_PF_IN_FLIGHT_VF_MSGS_THRESH, in ice_init_pf()
4097 ice_mbx_init_snapshot(&pf->hw); in ice_init_pf()
4099 xa_init(&pf->dyn_ports); in ice_init_pf()
4100 xa_init(&pf->sf_nums); in ice_init_pf()
4117 * word) indicates WoL is not supported on the corresponding PF ID. in ice_is_wol_supported()
4138 struct ice_pf *pf = vsi->back; in ice_vsi_recfg_qs() local
4144 while (test_and_set_bit(ICE_CFG_BUSY, pf->state)) { in ice_vsi_recfg_qs()
4161 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()
4177 ice_pf_dcb_recfg(pf, locked); in ice_vsi_recfg_qs()
4182 dev_err(ice_pf_to_dev(pf), "Error during VSI rebuild: %d. Unload and reload the driver.\n", in ice_vsi_recfg_qs()
4185 clear_bit(ICE_CFG_BUSY, pf->state); in ice_vsi_recfg_qs()
4190 * ice_set_safe_mode_vlan_cfg - configure PF VSI to allow all VLANs in safe mode
4191 * @pf: PF to configure
4193 * No VLAN offloads/filtering are advertised in safe mode so make sure the PF
4196 static void ice_set_safe_mode_vlan_cfg(struct ice_pf *pf) in ice_set_safe_mode_vlan_cfg() argument
4198 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_set_safe_mode_vlan_cfg()
4210 hw = &pf->hw; in ice_set_safe_mode_vlan_cfg()
4249 struct ice_pf *pf = hw->back; in ice_log_pkg_init() local
4252 dev = ice_pf_to_dev(pf); in ice_log_pkg_init()
4326 * @pf: pointer to the PF instance
4332 ice_load_pkg(const struct firmware *firmware, struct ice_pf *pf) in ice_load_pkg() argument
4335 struct device *dev = ice_pf_to_dev(pf); in ice_load_pkg()
4336 struct ice_hw *hw = &pf->hw; in ice_load_pkg()
4353 clear_bit(ICE_FLAG_ADV_FEATURES, pf->flags); in ice_load_pkg()
4360 set_bit(ICE_FLAG_ADV_FEATURES, pf->flags); in ice_load_pkg()
4365 * @pf: pointer to the PF structure
4371 static void ice_verify_cacheline_size(struct ice_pf *pf) in ice_verify_cacheline_size() argument
4373 if (rd32(&pf->hw, GLPCI_CNF2) & GLPCI_CNF2_CACHELINE_SIZE_M) in ice_verify_cacheline_size()
4374 …dev_warn(ice_pf_to_dev(pf), "%d Byte cache line assumption is invalid, driver may have Tx timeouts… in ice_verify_cacheline_size()
4380 * @pf: PF struct
4384 static int ice_send_version(struct ice_pf *pf) in ice_send_version() argument
4394 return ice_aq_send_driver_ver(&pf->hw, &dv, NULL); in ice_send_version()
4399 * @pf: pointer to the PF instance
4403 static int ice_init_fdir(struct ice_pf *pf) in ice_init_fdir() argument
4405 struct device *dev = ice_pf_to_dev(pf); in ice_init_fdir()
4410 * Allocate it and store it in the PF. in ice_init_fdir()
4412 ctrl_vsi = ice_ctrl_vsi_setup(pf, pf->hw.port_info); in ice_init_fdir()
4424 mutex_init(&pf->hw.fdir_fltr_lock); in ice_init_fdir()
4426 err = ice_fdir_create_dflt_rules(pf); in ice_init_fdir()
4433 ice_fdir_release_flows(&pf->hw); in ice_init_fdir()
4437 if (pf->ctrl_vsi_idx != ICE_NO_VSI) { in ice_init_fdir()
4438 pf->vsi[pf->ctrl_vsi_idx] = NULL; in ice_init_fdir()
4439 pf->ctrl_vsi_idx = ICE_NO_VSI; in ice_init_fdir()
4444 static void ice_deinit_fdir(struct ice_pf *pf) in ice_deinit_fdir() argument
4446 struct ice_vsi *vsi = ice_get_ctrl_vsi(pf); in ice_deinit_fdir()
4453 if (pf->ctrl_vsi_idx != ICE_NO_VSI) { in ice_deinit_fdir()
4454 pf->vsi[pf->ctrl_vsi_idx] = NULL; in ice_deinit_fdir()
4455 pf->ctrl_vsi_idx = ICE_NO_VSI; in ice_deinit_fdir()
4458 mutex_destroy(&(&pf->hw)->fdir_fltr_lock); in ice_deinit_fdir()
4463 * @pf: pointer to the PF instance
4465 static char *ice_get_opt_fw_name(struct ice_pf *pf) in ice_get_opt_fw_name() argument
4470 struct pci_dev *pdev = pf->pdev; in ice_get_opt_fw_name()
4493 * @pf: pointer to the PF instance
4498 static int ice_request_fw(struct ice_pf *pf, const struct firmware **firmware) in ice_request_fw() argument
4500 char *opt_fw_filename = ice_get_opt_fw_name(pf); in ice_request_fw()
4501 struct device *dev = ice_pf_to_dev(pf); in ice_request_fw()
4532 struct ice_pf *pf = hw->back; in ice_init_tx_topology() local
4536 dev = ice_pf_to_dev(pf); in ice_init_tx_topology()
4560 * @pf: pointer to pf structure
4562 * The pf->supported_rxdids bitmap is used to indicate to VFs which descriptor
4563 * formats the PF hardware supports. The exact list of supported RXDIDs
4571 static void ice_init_supported_rxdids(struct ice_hw *hw, struct ice_pf *pf) in ice_init_supported_rxdids() argument
4573 pf->supported_rxdids = BIT(ICE_RXDID_LEGACY_1); in ice_init_supported_rxdids()
4581 pf->supported_rxdids |= BIT(i); in ice_init_supported_rxdids()
4588 * @pf: pointer to pf structure
4595 static int ice_init_ddp_config(struct ice_hw *hw, struct ice_pf *pf) in ice_init_ddp_config() argument
4597 struct device *dev = ice_pf_to_dev(pf); in ice_init_ddp_config()
4601 err = ice_request_fw(pf, &firmware); in ice_init_ddp_config()
4616 ice_load_pkg(firmware, pf); in ice_init_ddp_config()
4620 ice_init_supported_rxdids(hw, pf); in ice_init_ddp_config()
4627 * @pf: pointer to the PF struct
4629 static void ice_print_wake_reason(struct ice_pf *pf) in ice_print_wake_reason() argument
4631 u32 wus = pf->wakeup_reason; in ice_print_wake_reason()
4649 dev_info(ice_pf_to_dev(pf), "Wake reason: %s", wake_str); in ice_print_wake_reason()
4654 * @pf: pointer to the PF struct
4658 void ice_pf_fwlog_update_module(struct ice_pf *pf, int log_level, int module) in ice_pf_fwlog_update_module() argument
4660 struct ice_hw *hw = &pf->hw; in ice_pf_fwlog_update_module()
4769 int ice_init_dev(struct ice_pf *pf) in ice_init_dev() argument
4771 struct device *dev = ice_pf_to_dev(pf); in ice_init_dev()
4772 struct ice_hw *hw = &pf->hw; in ice_init_dev()
4793 ice_init_feature_support(pf); in ice_init_dev()
4795 err = ice_init_ddp_config(hw, pf); in ice_init_dev()
4798 * set in pf->state, which will cause ice_is_safe_mode to return in ice_init_dev()
4801 if (err || ice_is_safe_mode(pf)) { in ice_init_dev()
4810 err = ice_init_pf(pf); in ice_init_dev()
4816 pf->hw.udp_tunnel_nic.set_port = ice_udp_tunnel_set_port; in ice_init_dev()
4817 pf->hw.udp_tunnel_nic.unset_port = ice_udp_tunnel_unset_port; in ice_init_dev()
4818 pf->hw.udp_tunnel_nic.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP; in ice_init_dev()
4819 pf->hw.udp_tunnel_nic.shared = &pf->hw.udp_tunnel_shared; in ice_init_dev()
4820 if (pf->hw.tnl.valid_count[TNL_VXLAN]) { in ice_init_dev()
4821 pf->hw.udp_tunnel_nic.tables[0].n_entries = in ice_init_dev()
4822 pf->hw.tnl.valid_count[TNL_VXLAN]; in ice_init_dev()
4823 pf->hw.udp_tunnel_nic.tables[0].tunnel_types = in ice_init_dev()
4826 if (pf->hw.tnl.valid_count[TNL_GENEVE]) { in ice_init_dev()
4827 pf->hw.udp_tunnel_nic.tables[1].n_entries = in ice_init_dev()
4828 pf->hw.tnl.valid_count[TNL_GENEVE]; in ice_init_dev()
4829 pf->hw.udp_tunnel_nic.tables[1].tunnel_types = in ice_init_dev()
4833 err = ice_init_interrupt_scheme(pf); in ice_init_dev()
4845 err = ice_req_irq_msix_misc(pf); in ice_init_dev()
4854 ice_clear_interrupt_scheme(pf); in ice_init_dev()
4856 ice_deinit_pf(pf); in ice_init_dev()
4862 void ice_deinit_dev(struct ice_pf *pf) in ice_deinit_dev() argument
4864 ice_free_irq_msix_misc(pf); in ice_deinit_dev()
4865 ice_deinit_pf(pf); in ice_deinit_dev()
4866 ice_deinit_hw(&pf->hw); in ice_deinit_dev()
4869 ice_reset(&pf->hw, ICE_RESET_PFR); in ice_deinit_dev()
4870 pci_wait_for_pending_transaction(pf->pdev); in ice_deinit_dev()
4871 ice_clear_interrupt_scheme(pf); in ice_deinit_dev()
4874 static void ice_init_features(struct ice_pf *pf) in ice_init_features() argument
4876 struct device *dev = ice_pf_to_dev(pf); in ice_init_features()
4878 if (ice_is_safe_mode(pf)) in ice_init_features()
4882 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) in ice_init_features()
4883 ice_ptp_init(pf); in ice_init_features()
4885 if (ice_is_feature_supported(pf, ICE_F_GNSS)) in ice_init_features()
4886 ice_gnss_init(pf); in ice_init_features()
4888 if (ice_is_feature_supported(pf, ICE_F_CGU) || in ice_init_features()
4889 ice_is_feature_supported(pf, ICE_F_PHY_RCLK)) in ice_init_features()
4890 ice_dpll_init(pf); in ice_init_features()
4893 if (ice_init_fdir(pf)) in ice_init_features()
4897 if (ice_init_pf_dcb(pf, false)) { in ice_init_features()
4898 clear_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); in ice_init_features()
4899 clear_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_init_features()
4901 ice_cfg_lldp_mib_change(&pf->hw, true); in ice_init_features()
4904 if (ice_init_lag(pf)) in ice_init_features()
4907 ice_hwmon_init(pf); in ice_init_features()
4910 static void ice_deinit_features(struct ice_pf *pf) in ice_deinit_features() argument
4912 if (ice_is_safe_mode(pf)) in ice_deinit_features()
4915 ice_deinit_lag(pf); in ice_deinit_features()
4916 if (test_bit(ICE_FLAG_DCB_CAPABLE, pf->flags)) in ice_deinit_features()
4917 ice_cfg_lldp_mib_change(&pf->hw, false); in ice_deinit_features()
4918 ice_deinit_fdir(pf); in ice_deinit_features()
4919 if (ice_is_feature_supported(pf, ICE_F_GNSS)) in ice_deinit_features()
4920 ice_gnss_exit(pf); in ice_deinit_features()
4921 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) in ice_deinit_features()
4922 ice_ptp_release(pf); in ice_deinit_features()
4923 if (test_bit(ICE_FLAG_DPLL, pf->flags)) in ice_deinit_features()
4924 ice_dpll_deinit(pf); in ice_deinit_features()
4925 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV) in ice_deinit_features()
4926 xa_destroy(&pf->eswitch.reprs); in ice_deinit_features()
4929 static void ice_init_wakeup(struct ice_pf *pf) in ice_init_wakeup() argument
4932 pf->wakeup_reason = rd32(&pf->hw, PFPM_WUS); in ice_init_wakeup()
4935 ice_print_wake_reason(pf); in ice_init_wakeup()
4938 wr32(&pf->hw, PFPM_WUS, U32_MAX); in ice_init_wakeup()
4941 device_set_wakeup_enable(ice_pf_to_dev(pf), false); in ice_init_wakeup()
4944 static int ice_init_link(struct ice_pf *pf) in ice_init_link() argument
4946 struct device *dev = ice_pf_to_dev(pf); in ice_init_link()
4949 err = ice_init_link_events(pf->hw.port_info); in ice_init_link()
4956 err = ice_init_nvm_phy_type(pf->hw.port_info); in ice_init_link()
4961 err = ice_update_link_info(pf->hw.port_info); in ice_init_link()
4965 ice_init_link_dflt_override(pf->hw.port_info); in ice_init_link()
4967 ice_check_link_cfg_err(pf, in ice_init_link()
4968 pf->hw.port_info->phy.link_info.link_cfg_err); in ice_init_link()
4971 if (pf->hw.port_info->phy.link_info.link_info & in ice_init_link()
4974 err = ice_init_phy_user_cfg(pf->hw.port_info); in ice_init_link()
4978 if (!test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags)) { in ice_init_link()
4979 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_init_link()
4985 set_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_init_link()
4991 static int ice_init_pf_sw(struct ice_pf *pf) in ice_init_pf_sw() argument
4993 bool dvm = ice_is_dvm_ena(&pf->hw); in ice_init_pf_sw()
4998 pf->first_sw = kzalloc(sizeof(*pf->first_sw), GFP_KERNEL); in ice_init_pf_sw()
4999 if (!pf->first_sw) in ice_init_pf_sw()
5002 if (pf->hw.evb_veb) in ice_init_pf_sw()
5003 pf->first_sw->bridge_mode = BRIDGE_MODE_VEB; in ice_init_pf_sw()
5005 pf->first_sw->bridge_mode = BRIDGE_MODE_VEPA; in ice_init_pf_sw()
5007 pf->first_sw->pf = pf; in ice_init_pf_sw()
5010 pf->first_sw->sw_id = pf->hw.port_info->sw_id; in ice_init_pf_sw()
5012 err = ice_aq_set_port_params(pf->hw.port_info, dvm, NULL); in ice_init_pf_sw()
5016 vsi = ice_pf_vsi_setup(pf, pf->hw.port_info); in ice_init_pf_sw()
5026 kfree(pf->first_sw); in ice_init_pf_sw()
5030 static void ice_deinit_pf_sw(struct ice_pf *pf) in ice_deinit_pf_sw() argument
5032 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_deinit_pf_sw()
5038 kfree(pf->first_sw); in ice_deinit_pf_sw()
5041 static int ice_alloc_vsis(struct ice_pf *pf) in ice_alloc_vsis() argument
5043 struct device *dev = ice_pf_to_dev(pf); in ice_alloc_vsis()
5045 pf->num_alloc_vsi = pf->hw.func_caps.guar_num_vsi; in ice_alloc_vsis()
5046 if (!pf->num_alloc_vsi) in ice_alloc_vsis()
5049 if (pf->num_alloc_vsi > UDP_TUNNEL_NIC_MAX_SHARING_DEVICES) { in ice_alloc_vsis()
5052 pf->num_alloc_vsi, UDP_TUNNEL_NIC_MAX_SHARING_DEVICES); in ice_alloc_vsis()
5053 pf->num_alloc_vsi = UDP_TUNNEL_NIC_MAX_SHARING_DEVICES; in ice_alloc_vsis()
5056 pf->vsi = devm_kcalloc(dev, pf->num_alloc_vsi, sizeof(*pf->vsi), in ice_alloc_vsis()
5058 if (!pf->vsi) in ice_alloc_vsis()
5061 pf->vsi_stats = devm_kcalloc(dev, pf->num_alloc_vsi, in ice_alloc_vsis()
5062 sizeof(*pf->vsi_stats), GFP_KERNEL); in ice_alloc_vsis()
5063 if (!pf->vsi_stats) { in ice_alloc_vsis()
5064 devm_kfree(dev, pf->vsi); in ice_alloc_vsis()
5071 static void ice_dealloc_vsis(struct ice_pf *pf) in ice_dealloc_vsis() argument
5073 devm_kfree(ice_pf_to_dev(pf), pf->vsi_stats); in ice_dealloc_vsis()
5074 pf->vsi_stats = NULL; in ice_dealloc_vsis()
5076 pf->num_alloc_vsi = 0; in ice_dealloc_vsis()
5077 devm_kfree(ice_pf_to_dev(pf), pf->vsi); in ice_dealloc_vsis()
5078 pf->vsi = NULL; in ice_dealloc_vsis()
5081 static int ice_init_devlink(struct ice_pf *pf) in ice_init_devlink() argument
5085 err = ice_devlink_register_params(pf); in ice_init_devlink()
5089 ice_devlink_init_regions(pf); in ice_init_devlink()
5090 ice_devlink_register(pf); in ice_init_devlink()
5095 static void ice_deinit_devlink(struct ice_pf *pf) in ice_deinit_devlink() argument
5097 ice_devlink_unregister(pf); in ice_deinit_devlink()
5098 ice_devlink_destroy_regions(pf); in ice_deinit_devlink()
5099 ice_devlink_unregister_params(pf); in ice_deinit_devlink()
5102 static int ice_init(struct ice_pf *pf) in ice_init() argument
5106 err = ice_init_dev(pf); in ice_init()
5110 err = ice_alloc_vsis(pf); in ice_init()
5114 err = ice_init_pf_sw(pf); in ice_init()
5118 ice_init_wakeup(pf); in ice_init()
5120 err = ice_init_link(pf); in ice_init()
5124 err = ice_send_version(pf); in ice_init()
5128 ice_verify_cacheline_size(pf); in ice_init()
5130 if (ice_is_safe_mode(pf)) in ice_init()
5131 ice_set_safe_mode_vlan_cfg(pf); in ice_init()
5134 pcie_print_link_status(pf->pdev); in ice_init()
5137 clear_bit(ICE_DOWN, pf->state); in ice_init()
5138 clear_bit(ICE_SERVICE_DIS, pf->state); in ice_init()
5141 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); in ice_init()
5146 ice_deinit_pf_sw(pf); in ice_init()
5148 ice_dealloc_vsis(pf); in ice_init()
5150 ice_deinit_dev(pf); in ice_init()
5154 static void ice_deinit(struct ice_pf *pf) in ice_deinit() argument
5156 set_bit(ICE_SERVICE_DIS, pf->state); in ice_deinit()
5157 set_bit(ICE_DOWN, pf->state); in ice_deinit()
5159 ice_deinit_pf_sw(pf); in ice_deinit()
5160 ice_dealloc_vsis(pf); in ice_deinit()
5161 ice_deinit_dev(pf); in ice_deinit()
5165 * ice_load - load pf by init hw and starting VSI
5166 * @pf: pointer to the pf instance
5170 int ice_load(struct ice_pf *pf) in ice_load() argument
5175 devl_assert_locked(priv_to_devlink(pf)); in ice_load()
5177 vsi = ice_get_main_vsi(pf); in ice_load()
5189 err = ice_init_mac_fltr(pf); in ice_load()
5193 err = ice_devlink_create_pf_port(pf); in ice_load()
5197 SET_NETDEV_DEVLINK_PORT(vsi->netdev, &pf->devlink_port); in ice_load()
5209 err = ice_init_rdma(pf); in ice_load()
5213 ice_init_features(pf); in ice_load()
5214 ice_service_task_restart(pf); in ice_load()
5216 clear_bit(ICE_DOWN, pf->state); in ice_load()
5225 ice_devlink_destroy_pf_port(pf); in ice_load()
5233 * ice_unload - unload pf by stopping VSI and deinit hw
5234 * @pf: pointer to the pf instance
5238 void ice_unload(struct ice_pf *pf) in ice_unload() argument
5240 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_unload()
5242 devl_assert_locked(priv_to_devlink(pf)); in ice_unload()
5244 ice_deinit_features(pf); in ice_unload()
5245 ice_deinit_rdma(pf); in ice_unload()
5248 ice_devlink_destroy_pf_port(pf); in ice_unload()
5264 struct ice_pf *pf; in ice_probe() local
5300 pf = ice_allocate_pf(dev); in ice_probe()
5301 if (!pf) in ice_probe()
5305 pf->aux_idx = -1; in ice_probe()
5320 pf->pdev = pdev; in ice_probe()
5321 pf->adapter = adapter; in ice_probe()
5322 pci_set_drvdata(pdev, pf); in ice_probe()
5323 set_bit(ICE_DOWN, pf->state); in ice_probe()
5325 set_bit(ICE_SERVICE_DIS, pf->state); in ice_probe()
5327 hw = &pf->hw; in ice_probe()
5331 hw->back = pf; in ice_probe()
5342 pf->msg_enable = netif_msg_init(debug, ICE_DFLT_NETIF_M); in ice_probe()
5349 err = ice_init(pf); in ice_probe()
5353 devl_lock(priv_to_devlink(pf)); in ice_probe()
5354 err = ice_load(pf); in ice_probe()
5358 err = ice_init_devlink(pf); in ice_probe()
5361 devl_unlock(priv_to_devlink(pf)); in ice_probe()
5366 ice_unload(pf); in ice_probe()
5368 devl_unlock(priv_to_devlink(pf)); in ice_probe()
5369 ice_deinit(pf); in ice_probe()
5377 * @pf: pointer to the PF struct
5381 static void ice_set_wake(struct ice_pf *pf) in ice_set_wake() argument
5383 struct ice_hw *hw = &pf->hw; in ice_set_wake()
5384 bool wol = pf->wol_ena; in ice_set_wake()
5398 * @pf: pointer to the PF struct
5402 * wake, and that PF reset doesn't undo the LAA.
5404 static void ice_setup_mc_magic_wake(struct ice_pf *pf) in ice_setup_mc_magic_wake() argument
5406 struct device *dev = ice_pf_to_dev(pf); in ice_setup_mc_magic_wake()
5407 struct ice_hw *hw = &pf->hw; in ice_setup_mc_magic_wake()
5413 if (!pf->wol_ena) in ice_setup_mc_magic_wake()
5416 vsi = ice_get_main_vsi(pf); in ice_setup_mc_magic_wake()
5442 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_remove() local
5446 if (!ice_is_reset_in_progress(pf->state)) in ice_remove()
5451 if (test_bit(ICE_FLAG_SRIOV_ENA, pf->flags)) { in ice_remove()
5452 set_bit(ICE_VF_RESETS_DISABLED, pf->state); in ice_remove()
5453 ice_free_vfs(pf); in ice_remove()
5456 ice_hwmon_exit(pf); in ice_remove()
5458 ice_service_task_stop(pf); in ice_remove()
5459 ice_aq_cancel_waiting_tasks(pf); in ice_remove()
5460 set_bit(ICE_DOWN, pf->state); in ice_remove()
5462 if (!ice_is_safe_mode(pf)) in ice_remove()
5463 ice_remove_arfs(pf); in ice_remove()
5465 devl_lock(priv_to_devlink(pf)); in ice_remove()
5466 ice_dealloc_all_dynamic_ports(pf); in ice_remove()
5467 ice_deinit_devlink(pf); in ice_remove()
5469 ice_unload(pf); in ice_remove()
5470 devl_unlock(priv_to_devlink(pf)); in ice_remove()
5472 ice_deinit(pf); in ice_remove()
5473 ice_vsi_release_all(pf); in ice_remove()
5475 ice_setup_mc_magic_wake(pf); in ice_remove()
5476 ice_set_wake(pf); in ice_remove()
5487 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_shutdown() local
5492 pci_wake_from_d3(pdev, pf->wol_ena); in ice_shutdown()
5499 * @pf: board private structure
5503 static void ice_prepare_for_shutdown(struct ice_pf *pf) in ice_prepare_for_shutdown() argument
5505 struct ice_hw *hw = &pf->hw; in ice_prepare_for_shutdown()
5510 ice_vc_notify_reset(pf); in ice_prepare_for_shutdown()
5512 dev_dbg(ice_pf_to_dev(pf), "Tearing down internal switch for shutdown\n"); in ice_prepare_for_shutdown()
5515 ice_pf_dis_all_vsi(pf, false); in ice_prepare_for_shutdown()
5517 ice_for_each_vsi(pf, v) in ice_prepare_for_shutdown()
5518 if (pf->vsi[v]) in ice_prepare_for_shutdown()
5519 pf->vsi[v]->vsi_num = 0; in ice_prepare_for_shutdown()
5526 * @pf: board private structure to reinitialize
5534 static int ice_reinit_interrupt_scheme(struct ice_pf *pf) in ice_reinit_interrupt_scheme() argument
5536 struct device *dev = ice_pf_to_dev(pf); in ice_reinit_interrupt_scheme()
5543 ret = ice_init_interrupt_scheme(pf); in ice_reinit_interrupt_scheme()
5550 ice_for_each_vsi(pf, v) { in ice_reinit_interrupt_scheme()
5551 if (!pf->vsi[v]) in ice_reinit_interrupt_scheme()
5554 ret = ice_vsi_alloc_q_vectors(pf->vsi[v]); in ice_reinit_interrupt_scheme()
5557 ice_vsi_map_rings_to_vectors(pf->vsi[v]); in ice_reinit_interrupt_scheme()
5559 ice_vsi_set_napi_queues(pf->vsi[v]); in ice_reinit_interrupt_scheme()
5563 ret = ice_req_irq_msix_misc(pf); in ice_reinit_interrupt_scheme()
5574 if (pf->vsi[v]) { in ice_reinit_interrupt_scheme()
5576 ice_vsi_clear_napi_queues(pf->vsi[v]); in ice_reinit_interrupt_scheme()
5578 ice_vsi_free_q_vectors(pf->vsi[v]); in ice_reinit_interrupt_scheme()
5594 struct ice_pf *pf; in ice_suspend() local
5597 pf = pci_get_drvdata(pdev); in ice_suspend()
5599 if (!ice_pf_state_is_nominal(pf)) { in ice_suspend()
5610 disabled = ice_service_task_stop(pf); in ice_suspend()
5612 ice_deinit_rdma(pf); in ice_suspend()
5615 if (test_and_set_bit(ICE_SUSPENDED, pf->state)) { in ice_suspend()
5617 ice_service_task_restart(pf); in ice_suspend()
5621 if (test_bit(ICE_DOWN, pf->state) || in ice_suspend()
5622 ice_is_reset_in_progress(pf->state)) { in ice_suspend()
5625 ice_service_task_restart(pf); in ice_suspend()
5629 ice_setup_mc_magic_wake(pf); in ice_suspend()
5631 ice_prepare_for_shutdown(pf); in ice_suspend()
5633 ice_set_wake(pf); in ice_suspend()
5640 ice_free_irq_msix_misc(pf); in ice_suspend()
5641 ice_for_each_vsi(pf, v) { in ice_suspend()
5642 if (!pf->vsi[v]) in ice_suspend()
5645 ice_vsi_clear_napi_queues(pf->vsi[v]); in ice_suspend()
5647 ice_vsi_free_q_vectors(pf->vsi[v]); in ice_suspend()
5649 ice_clear_interrupt_scheme(pf); in ice_suspend()
5652 pci_wake_from_d3(pdev, pf->wol_ena); in ice_suspend()
5665 struct ice_pf *pf; in ice_resume() local
5682 pf = pci_get_drvdata(pdev); in ice_resume()
5683 hw = &pf->hw; in ice_resume()
5685 pf->wakeup_reason = rd32(hw, PFPM_WUS); in ice_resume()
5686 ice_print_wake_reason(pf); in ice_resume()
5691 ret = ice_reinit_interrupt_scheme(pf); in ice_resume()
5695 ret = ice_init_rdma(pf); in ice_resume()
5700 clear_bit(ICE_DOWN, pf->state); in ice_resume()
5701 /* Now perform PF reset and rebuild */ in ice_resume()
5704 clear_bit(ICE_SERVICE_DIS, pf->state); in ice_resume()
5706 if (ice_schedule_reset(pf, reset_type)) in ice_resume()
5709 clear_bit(ICE_SUSPENDED, pf->state); in ice_resume()
5710 ice_service_task_restart(pf); in ice_resume()
5713 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); in ice_resume()
5729 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_detected() local
5731 if (!pf) { in ice_pci_err_detected()
5737 if (!test_bit(ICE_SUSPENDED, pf->state)) { in ice_pci_err_detected()
5738 ice_service_task_stop(pf); in ice_pci_err_detected()
5740 if (!test_bit(ICE_PREPARED_FOR_RESET, pf->state)) { in ice_pci_err_detected()
5741 set_bit(ICE_PFR_REQ, pf->state); in ice_pci_err_detected()
5742 ice_prepare_for_reset(pf, ICE_RESET_PFR); in ice_pci_err_detected()
5758 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_slot_reset() local
5775 reg = rd32(&pf->hw, GLGEN_RTRIG); in ice_pci_err_slot_reset()
5794 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_resume() local
5796 if (!pf) { in ice_pci_err_resume()
5802 if (test_bit(ICE_SUSPENDED, pf->state)) { in ice_pci_err_resume()
5808 ice_restore_all_vfs_msi_state(pf); in ice_pci_err_resume()
5810 ice_do_reset(pf, ICE_RESET_PFR); in ice_pci_err_resume()
5811 ice_service_task_restart(pf); in ice_pci_err_resume()
5812 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); in ice_pci_err_resume()
5821 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_reset_prepare() local
5823 if (!test_bit(ICE_SUSPENDED, pf->state)) { in ice_pci_err_reset_prepare()
5824 ice_service_task_stop(pf); in ice_pci_err_reset_prepare()
5826 if (!test_bit(ICE_PREPARED_FOR_RESET, pf->state)) { in ice_pci_err_reset_prepare()
5827 set_bit(ICE_PFR_REQ, pf->state); in ice_pci_err_reset_prepare()
5828 ice_prepare_for_reset(pf, ICE_RESET_PFR); in ice_pci_err_reset_prepare()
6001 struct ice_pf *pf = vsi->back; in ice_set_mac_address() local
6002 struct ice_hw *hw = &pf->hw; in ice_set_mac_address()
6014 if (test_bit(ICE_DOWN, pf->state) || in ice_set_mac_address()
6015 ice_is_reset_in_progress(pf->state)) { in ice_set_mac_address()
6021 if (ice_chnl_dmac_fltr_cnt(pf)) { in ice_set_mac_address()
6333 * @vsi: PF's VSI
6349 * ice_set_vlan_offload_features - set VLAN offload features for the PF VSI
6350 * @vsi: PF's VSI
6397 * ice_set_vlan_filtering_features - set VLAN filtering features for the PF VSI
6398 * @vsi: PF's VSI
6468 * ice_set_loopback - turn on/off loopback mode on underlying PF
6504 struct ice_pf *pf = vsi->back; in ice_set_features() local
6508 if (ice_is_safe_mode(pf)) { in ice_set_features()
6509 dev_err(ice_pf_to_dev(pf), in ice_set_features()
6515 if (ice_is_reset_in_progress(pf->state)) { in ice_set_features()
6516 dev_err(ice_pf_to_dev(pf), in ice_set_features()
6556 if (!(features & NETIF_F_HW_TC) && ice_is_adq_active(pf)) { in ice_set_features()
6557 dev_err(ice_pf_to_dev(pf), "ADQ is active, can't turn hw_tc_offload off\n"); in ice_set_features()
6564 assign_bit(ICE_FLAG_CLS_FLOWER, pf->flags, ena); in ice_set_features()
6574 * ice_vsi_vlan_setup - Setup VLAN offload properties on a PF VSI
6769 struct ice_pf *pf = vsi->back; in ice_up_complete() local
6793 ice_ptp_link_change(pf, pf->hw.pf_id, true); in ice_up_complete()
6802 ice_service_task_schedule(pf); in ice_up_complete()
6885 struct ice_pf *pf = vsi->back; in ice_update_vsi_ring_stats() local
6932 * random value after PF reset. And as we increase the reported stat by in ice_update_vsi_ring_stats()
6936 if (likely(pf->stat_prev_loaded)) { in ice_update_vsi_ring_stats()
6959 struct ice_pf *pf = vsi->back; in ice_update_vsi_stats() local
6962 test_bit(ICE_CFG_BUSY, pf->state)) in ice_update_vsi_stats()
6978 cur_ns->rx_crc_errors = pf->stats.crc_errors; in ice_update_vsi_stats()
6979 cur_ns->rx_errors = pf->stats.crc_errors + in ice_update_vsi_stats()
6980 pf->stats.illegal_bytes + in ice_update_vsi_stats()
6981 pf->stats.rx_undersize + in ice_update_vsi_stats()
6982 pf->hw_csum_rx_error + in ice_update_vsi_stats()
6983 pf->stats.rx_jabber + in ice_update_vsi_stats()
6984 pf->stats.rx_fragments + in ice_update_vsi_stats()
6985 pf->stats.rx_oversize; in ice_update_vsi_stats()
6987 cur_ns->rx_missed_errors = pf->stats.eth.rx_discards; in ice_update_vsi_stats()
6992 * ice_update_pf_stats - Update PF port stats counters
6993 * @pf: PF whose stats needs to be updated
6995 void ice_update_pf_stats(struct ice_pf *pf) in ice_update_pf_stats() argument
6998 struct ice_hw *hw = &pf->hw; in ice_update_pf_stats()
7003 prev_ps = &pf->stats_prev; in ice_update_pf_stats()
7004 cur_ps = &pf->stats; in ice_update_pf_stats()
7006 if (ice_is_reset_in_progress(pf->state)) in ice_update_pf_stats()
7007 pf->stat_prev_loaded = false; in ice_update_pf_stats()
7009 ice_stat_update40(hw, GLPRT_GORCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7013 ice_stat_update40(hw, GLPRT_UPRCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7017 ice_stat_update40(hw, GLPRT_MPRCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7021 ice_stat_update40(hw, GLPRT_BPRCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7025 ice_stat_update32(hw, PRTRPB_RDPC, pf->stat_prev_loaded, in ice_update_pf_stats()
7029 ice_stat_update40(hw, GLPRT_GOTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7033 ice_stat_update40(hw, GLPRT_UPTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7037 ice_stat_update40(hw, GLPRT_MPTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7041 ice_stat_update40(hw, GLPRT_BPTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7045 ice_stat_update32(hw, GLPRT_TDOLD(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7049 ice_stat_update40(hw, GLPRT_PRC64L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7052 ice_stat_update40(hw, GLPRT_PRC127L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7055 ice_stat_update40(hw, GLPRT_PRC255L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7058 ice_stat_update40(hw, GLPRT_PRC511L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7061 ice_stat_update40(hw, GLPRT_PRC1023L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7064 ice_stat_update40(hw, GLPRT_PRC1522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7067 ice_stat_update40(hw, GLPRT_PRC9522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7070 ice_stat_update40(hw, GLPRT_PTC64L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7073 ice_stat_update40(hw, GLPRT_PTC127L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7076 ice_stat_update40(hw, GLPRT_PTC255L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7079 ice_stat_update40(hw, GLPRT_PTC511L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7082 ice_stat_update40(hw, GLPRT_PTC1023L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7085 ice_stat_update40(hw, GLPRT_PTC1522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7088 ice_stat_update40(hw, GLPRT_PTC9522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7095 pf->stat_prev_loaded, &prev_ps->fd_sb_match, in ice_update_pf_stats()
7097 ice_stat_update32(hw, GLPRT_LXONRXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7100 ice_stat_update32(hw, GLPRT_LXOFFRXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7103 ice_stat_update32(hw, GLPRT_LXONTXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7106 ice_stat_update32(hw, GLPRT_LXOFFTXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7109 ice_update_dcb_stats(pf); in ice_update_pf_stats()
7111 ice_stat_update32(hw, GLPRT_CRCERRS(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7114 ice_stat_update32(hw, GLPRT_ILLERRC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7117 ice_stat_update32(hw, GLPRT_MLFC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7121 ice_stat_update32(hw, GLPRT_MRFC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7125 ice_stat_update32(hw, GLPRT_RUC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7128 ice_stat_update32(hw, GLPRT_RFC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7131 ice_stat_update32(hw, GLPRT_ROC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7134 ice_stat_update32(hw, GLPRT_RJC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
7137 cur_ps->fd_sb_status = test_bit(ICE_FLAG_FD_ENA, pf->flags) ? 1 : 0; in ice_update_pf_stats()
7139 pf->stat_prev_loaded = true; in ice_update_pf_stats()
7211 struct ice_pf *pf = vsi->back; in ice_vsi_dis_irq() local
7212 struct ice_hw *hw = &pf->hw; in ice_vsi_dis_irq()
7407 struct ice_pf *pf = vsi->back; in ice_vsi_open_ctrl() local
7411 dev = ice_pf_to_dev(pf); in ice_vsi_open_ctrl()
7463 struct ice_pf *pf = vsi->back; in ice_vsi_open() local
7480 dev_driver_string(ice_pf_to_dev(pf)), vsi->netdev->name); in ice_vsi_open()
7520 * @pf: PF from which all VSIs are being removed
7522 static void ice_vsi_release_all(struct ice_pf *pf) in ice_vsi_release_all() argument
7526 if (!pf->vsi) in ice_vsi_release_all()
7529 ice_for_each_vsi(pf, i) { in ice_vsi_release_all()
7530 if (!pf->vsi[i]) in ice_vsi_release_all()
7533 if (pf->vsi[i]->type == ICE_VSI_CHNL) in ice_vsi_release_all()
7536 err = ice_vsi_release(pf->vsi[i]); in ice_vsi_release_all()
7538 dev_dbg(ice_pf_to_dev(pf), "Failed to release pf->vsi[%d], err %d, vsi_num = %d\n", in ice_vsi_release_all()
7539 i, err, pf->vsi[i]->vsi_num); in ice_vsi_release_all()
7545 * @pf: pointer to the PF instance
7548 * Iterates through the pf->vsi array and rebuilds VSIs of the requested type
7550 static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type) in ice_vsi_rebuild_by_type() argument
7552 struct device *dev = ice_pf_to_dev(pf); in ice_vsi_rebuild_by_type()
7555 ice_for_each_vsi(pf, i) { in ice_vsi_rebuild_by_type()
7556 struct ice_vsi *vsi = pf->vsi[i]; in ice_vsi_rebuild_by_type()
7570 err = ice_replay_vsi(&pf->hw, vsi->idx); in ice_vsi_rebuild_by_type()
7580 vsi->vsi_num = ice_get_hw_vsi_num(&pf->hw, vsi->idx); in ice_vsi_rebuild_by_type()
7598 * ice_update_pf_netdev_link - Update PF netdev link status
7599 * @pf: pointer to the PF instance
7601 static void ice_update_pf_netdev_link(struct ice_pf *pf) in ice_update_pf_netdev_link() argument
7606 ice_for_each_vsi(pf, i) { in ice_update_pf_netdev_link()
7607 struct ice_vsi *vsi = pf->vsi[i]; in ice_update_pf_netdev_link()
7612 ice_get_link_status(pf->vsi[i]->port_info, &link_up); in ice_update_pf_netdev_link()
7614 netif_carrier_on(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
7615 netif_tx_wake_all_queues(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
7617 netif_carrier_off(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
7618 netif_tx_stop_all_queues(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
7625 * @pf: PF to rebuild
7633 static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) in ice_rebuild() argument
7635 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_rebuild()
7636 struct device *dev = ice_pf_to_dev(pf); in ice_rebuild()
7637 struct ice_hw *hw = &pf->hw; in ice_rebuild()
7641 if (test_bit(ICE_DOWN, pf->state)) in ice_rebuild()
7644 dev_dbg(dev, "rebuilding PF after reset_type=%d\n", reset_type); in ice_rebuild()
7652 pf->fw_emp_reset_disabled = false; in ice_rebuild()
7664 if (!ice_is_safe_mode(pf)) { in ice_rebuild()
7670 ice_load_pkg(NULL, pf); in ice_rebuild()
7675 dev_err(dev, "clear PF configuration failed %d\n", err); in ice_rebuild()
7701 err = ice_aq_set_port_params(pf->hw.port_info, dvm, NULL); in ice_rebuild()
7710 err = ice_req_irq_msix_misc(pf); in ice_rebuild()
7716 if (test_bit(ICE_FLAG_FD_ENA, pf->flags)) { in ice_rebuild()
7724 /* force guaranteed filter pool for PF */ in ice_rebuild()
7726 /* force shared filter pool for PF */ in ice_rebuild()
7731 if (test_bit(ICE_FLAG_DCB_ENA, pf->flags)) in ice_rebuild()
7732 ice_dcb_rebuild(pf); in ice_rebuild()
7734 /* If the PF previously had enabled PTP, PTP init needs to happen before in ice_rebuild()
7738 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) in ice_rebuild()
7739 ice_ptp_rebuild(pf, reset_type); in ice_rebuild()
7741 if (ice_is_feature_supported(pf, ICE_F_GNSS)) in ice_rebuild()
7742 ice_gnss_init(pf); in ice_rebuild()
7744 /* rebuild PF VSI */ in ice_rebuild()
7745 err = ice_vsi_rebuild_by_type(pf, ICE_VSI_PF); in ice_rebuild()
7747 dev_err(dev, "PF VSI rebuild failed: %d\n", err); in ice_rebuild()
7752 err = ice_rebuild_channels(pf); in ice_rebuild()
7761 if (test_bit(ICE_FLAG_FD_ENA, pf->flags)) { in ice_rebuild()
7762 err = ice_vsi_rebuild_by_type(pf, ICE_VSI_CTRL); in ice_rebuild()
7773 ice_fdir_replay_fltrs(pf); in ice_rebuild()
7775 ice_rebuild_arfs(pf); in ice_rebuild()
7781 ice_update_pf_netdev_link(pf); in ice_rebuild()
7784 err = ice_send_version(pf); in ice_rebuild()
7794 clear_bit(ICE_RESET_FAILED, pf->state); in ice_rebuild()
7796 ice_plug_aux_dev(pf); in ice_rebuild()
7797 if (ice_is_feature_supported(pf, ICE_F_SRIOV_LAG)) in ice_rebuild()
7798 ice_lag_rebuild(pf); in ice_rebuild()
7801 ice_ptp_restore_timestamp_mode(pf); in ice_rebuild()
7809 set_bit(ICE_RESET_FAILED, pf->state); in ice_rebuild()
7811 /* set this bit in PF state to control service task scheduling */ in ice_rebuild()
7812 set_bit(ICE_NEEDS_RESTART, pf->state); in ice_rebuild()
7827 struct ice_pf *pf = vsi->back; in ice_change_mtu() local
7846 } else if (test_bit(ICE_FLAG_LEGACY_RX, pf->flags)) { in ice_change_mtu()
7856 if (ice_is_reset_in_progress(pf->state)) { in ice_change_mtu()
7876 set_bit(ICE_FLAG_MTU_CHANGED, pf->flags); in ice_change_mtu()
7890 struct ice_pf *pf = np->vsi->back; in ice_eth_ioctl() local
7894 return ice_ptp_get_ts_config(pf, ifr); in ice_eth_ioctl()
7896 return ice_ptp_set_ts_config(pf, ifr); in ice_eth_ioctl()
8120 struct ice_pf *pf = vsi->back; in ice_bridge_getlink() local
8123 bmode = pf->first_sw->bridge_mode; in ice_bridge_getlink()
8181 * hooked up to. Iterates through the PF VSI list and sets the loopback mode (if
8191 struct ice_pf *pf = np->vsi->back; in ice_bridge_setlink() local
8193 struct ice_hw *hw = &pf->hw; in ice_bridge_setlink()
8197 pf_sw = pf->first_sw; in ice_bridge_setlink()
8211 /* Iterates through the PF VSI list and update the loopback in ice_bridge_setlink()
8214 ice_for_each_vsi(pf, v) { in ice_bridge_setlink()
8215 if (!pf->vsi[v]) in ice_bridge_setlink()
8217 err = ice_vsi_update_bridge_mode(pf->vsi[v], mode); in ice_bridge_setlink()
8252 struct ice_pf *pf = vsi->back; in ice_tx_timeout() local
8255 pf->tx_timeout_count++; in ice_tx_timeout()
8261 if (ice_is_pfc_causing_hung_q(pf, txqueue)) { in ice_tx_timeout()
8262 dev_info(ice_pf_to_dev(pf), "Fake Tx hang detected on queue %u, timeout caused by PFC storm\n", in ice_tx_timeout()
8278 if (time_after(jiffies, (pf->tx_timeout_last_recovery + HZ * 20))) in ice_tx_timeout()
8279 pf->tx_timeout_recovery_level = 1; in ice_tx_timeout()
8280 else if (time_before(jiffies, (pf->tx_timeout_last_recovery + in ice_tx_timeout()
8285 struct ice_hw *hw = &pf->hw; in ice_tx_timeout()
8298 pf->tx_timeout_last_recovery = jiffies; in ice_tx_timeout()
8300 pf->tx_timeout_recovery_level, txqueue); in ice_tx_timeout()
8302 switch (pf->tx_timeout_recovery_level) { in ice_tx_timeout()
8304 set_bit(ICE_PFR_REQ, pf->state); in ice_tx_timeout()
8307 set_bit(ICE_CORER_REQ, pf->state); in ice_tx_timeout()
8310 set_bit(ICE_GLOBR_REQ, pf->state); in ice_tx_timeout()
8314 set_bit(ICE_DOWN, pf->state); in ice_tx_timeout()
8316 set_bit(ICE_SERVICE_DIS, pf->state); in ice_tx_timeout()
8320 ice_service_task_schedule(pf); in ice_tx_timeout()
8321 pf->tx_timeout_recovery_level++; in ice_tx_timeout()
8384 struct ice_pf *pf = vsi->back; in ice_validate_mqprio_qopt() local
8399 dev = ice_pf_to_dev(pf); in ice_validate_mqprio_qopt()
8511 * ice_add_vsi_to_fdir - add a VSI to the flow director group for PF
8512 * @pf: ptr to PF device
8515 static int ice_add_vsi_to_fdir(struct ice_pf *pf, struct ice_vsi *vsi) in ice_add_vsi_to_fdir() argument
8517 struct device *dev = ice_pf_to_dev(pf); in ice_add_vsi_to_fdir()
8525 hw = &pf->hw; in ice_add_vsi_to_fdir()
8572 * @pf: ptr to PF device
8578 static int ice_add_channel(struct ice_pf *pf, u16 sw_id, struct ice_channel *ch) in ice_add_channel() argument
8580 struct device *dev = ice_pf_to_dev(pf); in ice_add_channel()
8588 vsi = ice_chnl_vsi_setup(pf, pf->hw.port_info, ch); in ice_add_channel()
8594 ice_add_vsi_to_fdir(pf, vsi); in ice_add_channel()
8686 * @pf: ptr to PF device
8696 ice_setup_hw_channel(struct ice_pf *pf, struct ice_vsi *vsi, in ice_setup_hw_channel() argument
8699 struct device *dev = ice_pf_to_dev(pf); in ice_setup_hw_channel()
8705 ret = ice_add_channel(pf, sw_id, ch); in ice_setup_hw_channel()
8726 * @pf: ptr to PF device
8734 ice_setup_channel(struct ice_pf *pf, struct ice_vsi *vsi, in ice_setup_channel() argument
8737 struct device *dev = ice_pf_to_dev(pf); in ice_setup_channel()
8746 sw_id = pf->first_sw->sw_id; in ice_setup_channel()
8749 ret = ice_setup_hw_channel(pf, vsi, ch, sw_id, ICE_VSI_CHNL); in ice_setup_channel()
8787 struct ice_pf *pf = vsi->back; in ice_create_q_channel() local
8793 dev = ice_pf_to_dev(pf); in ice_create_q_channel()
8805 if (!ice_setup_channel(pf, vsi, ch)) { in ice_create_q_channel()
8830 * @pf: ptr to PF, TC-flower based filter are tracked at PF level
8835 static void ice_rem_all_chnl_fltrs(struct ice_pf *pf) in ice_rem_all_chnl_fltrs() argument
8842 &pf->tc_flower_fltr_list, in ice_rem_all_chnl_fltrs()
8854 status = ice_rem_adv_rule_by_id(&pf->hw, &rule); in ice_rem_all_chnl_fltrs()
8857 dev_dbg(ice_pf_to_dev(pf), "TC flower filter (rule_id %u) does not exist\n", in ice_rem_all_chnl_fltrs()
8860 dev_err(ice_pf_to_dev(pf), "failed to delete TC flower filter, status %d\n", in ice_rem_all_chnl_fltrs()
8870 pf->num_dmac_chnl_fltrs--; in ice_rem_all_chnl_fltrs()
8889 struct ice_pf *pf = vsi->back; in ice_remove_q_channels() local
8894 ice_rem_all_chnl_fltrs(pf); in ice_remove_q_channels()
8898 struct ice_hw *hw = &pf->hw; in ice_remove_q_channels()
8936 ice_fdir_rem_adq_chnl(&pf->hw, ch->ch_vsi->idx); in ice_remove_q_channels()
8941 /* Delete VSI from FW, PF and HW VSI arrays */ in ice_remove_q_channels()
8959 * @pf: ptr to PF
8963 static int ice_rebuild_channels(struct ice_pf *pf) in ice_rebuild_channels() argument
8965 struct device *dev = ice_pf_to_dev(pf); in ice_rebuild_channels()
8973 main_vsi = ice_get_main_vsi(pf); in ice_rebuild_channels()
8977 if (!test_bit(ICE_FLAG_TC_MQPRIO, pf->flags) || in ice_rebuild_channels()
8992 ice_for_each_vsi(pf, i) { in ice_rebuild_channels()
8995 vsi = pf->vsi[i]; in ice_rebuild_channels()
9012 vsi->vsi_num = ice_get_hw_vsi_num(&pf->hw, vsi->idx); in ice_rebuild_channels()
9015 err = ice_replay_vsi(&pf->hw, vsi->idx); in ice_rebuild_channels()
9079 struct ice_pf *pf = vsi->back; in ice_create_q_channels() local
9109 dev_err(ice_pf_to_dev(pf), in ice_create_q_channels()
9116 dev_dbg(ice_pf_to_dev(pf), in ice_create_q_channels()
9137 struct ice_pf *pf = vsi->back; in ice_setup_tc_mqprio_qdisc() local
9144 dev = ice_pf_to_dev(pf); in ice_setup_tc_mqprio_qdisc()
9149 clear_bit(ICE_FLAG_TC_MQPRIO, pf->flags); in ice_setup_tc_mqprio_qdisc()
9162 if (pf->hw.port_info->is_custom_tx_enabled) { in ice_setup_tc_mqprio_qdisc()
9166 ice_tear_down_devlink_rate_tree(pf); in ice_setup_tc_mqprio_qdisc()
9175 set_bit(ICE_FLAG_TC_MQPRIO, pf->flags); in ice_setup_tc_mqprio_qdisc()
9181 set_bit(ICE_FLAG_CLS_FLOWER, pf->flags); in ice_setup_tc_mqprio_qdisc()
9197 if (!hw && !test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) in ice_setup_tc_mqprio_qdisc()
9200 if (!hw && !test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) { in ice_setup_tc_mqprio_qdisc()
9201 vsi->req_txq = min_t(int, ice_get_avail_txq_count(pf), in ice_setup_tc_mqprio_qdisc()
9203 vsi->req_rxq = min_t(int, ice_get_avail_rxq_count(pf), in ice_setup_tc_mqprio_qdisc()
9240 clear_bit(ICE_RESET_FAILED, pf->state); in ice_setup_tc_mqprio_qdisc()
9256 if (test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) { in ice_setup_tc_mqprio_qdisc()
9309 struct ice_pf *pf = np->vsi->back; in ice_setup_tc() local
9320 if (ice_is_eswitch_mode_switchdev(pf)) { in ice_setup_tc()
9325 if (pf->adev) { in ice_setup_tc()
9326 mutex_lock(&pf->adev_mutex); in ice_setup_tc()
9327 device_lock(&pf->adev->dev); in ice_setup_tc()
9329 if (pf->adev->dev.driver) { in ice_setup_tc()
9337 mutex_lock(&pf->tc_mutex); in ice_setup_tc()
9339 mutex_unlock(&pf->tc_mutex); in ice_setup_tc()
9343 device_unlock(&pf->adev->dev); in ice_setup_tc()
9344 mutex_unlock(&pf->adev_mutex); in ice_setup_tc()
9483 struct ice_pf *pf = np->vsi->back; in ice_open() local
9485 if (ice_is_reset_in_progress(pf->state)) { in ice_open()
9506 struct ice_pf *pf = vsi->back; in ice_open_internal() local
9510 if (test_bit(ICE_NEEDS_RESTART, pf->state)) { in ice_open_internal()
9524 ice_check_link_cfg_err(pf, pi->phy.link_info.link_cfg_err); in ice_open_internal()
9528 clear_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_open_internal()
9529 if (!test_bit(ICE_PHY_INIT_COMPLETE, pf->state)) { in ice_open_internal()
9545 set_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_open_internal()
9574 struct ice_pf *pf = vsi->back; in ice_stop() local
9576 if (ice_is_reset_in_progress(pf->state)) { in ice_stop()