Lines Matching full:pf

61 	struct ice_pf *pf = container_of(hw, struct ice_pf, hw);  in ice_hw_to_dev()  local
63 return &pf->pdev->dev; in ice_hw_to_dev()
70 static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type);
72 static void ice_vsi_release_all(struct ice_pf *pf);
74 static int ice_rebuild_channels(struct ice_pf *pf);
107 * @pf: pointer to PF struct
109 static void ice_check_for_hang_subtask(struct ice_pf *pf) in ice_check_for_hang_subtask() argument
117 ice_for_each_vsi(pf, v) in ice_check_for_hang_subtask()
118 if (pf->vsi[v] && pf->vsi[v]->type == ICE_VSI_PF) { in ice_check_for_hang_subtask()
119 vsi = pf->vsi[v]; in ice_check_for_hang_subtask()
166 * @pf: board private structure
168 * Set initial set of MAC filters for PF VSI; configure filters for permanent
172 static int ice_init_mac_fltr(struct ice_pf *pf) in ice_init_mac_fltr() argument
177 vsi = ice_get_main_vsi(pf); in ice_init_mac_fltr()
250 * ice_set_promisc - Enable promiscuous mode for a given PF
277 * ice_clear_promisc - Disable promiscuous mode for a given PF
307 struct ice_pf *pf = ice_netdev_to_pf(netdev); in ice_get_devlink_port() local
309 if (!ice_is_switchdev_running(pf)) in ice_get_devlink_port()
312 return &pf->devlink_port; in ice_get_devlink_port()
327 struct ice_pf *pf = vsi->back; in ice_vsi_sync_fltr() local
328 struct ice_hw *hw = &pf->hw; in ice_vsi_sync_fltr()
460 * @pf: board private structure
462 static void ice_sync_fltr_subtask(struct ice_pf *pf) in ice_sync_fltr_subtask() argument
466 if (!pf || !(test_bit(ICE_FLAG_FLTR_SYNC, pf->flags))) in ice_sync_fltr_subtask()
469 clear_bit(ICE_FLAG_FLTR_SYNC, pf->flags); in ice_sync_fltr_subtask()
471 ice_for_each_vsi(pf, v) in ice_sync_fltr_subtask()
472 if (pf->vsi[v] && ice_vsi_fltr_changed(pf->vsi[v]) && in ice_sync_fltr_subtask()
473 ice_vsi_sync_fltr(pf->vsi[v])) { in ice_sync_fltr_subtask()
475 set_bit(ICE_FLAG_FLTR_SYNC, pf->flags); in ice_sync_fltr_subtask()
481 * ice_pf_dis_all_vsi - Pause all VSIs on a PF
482 * @pf: the PF
485 static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked) in ice_pf_dis_all_vsi() argument
490 ice_for_each_vsi(pf, v) in ice_pf_dis_all_vsi()
491 if (pf->vsi[v]) in ice_pf_dis_all_vsi()
492 ice_dis_vsi(pf->vsi[v], locked); in ice_pf_dis_all_vsi()
495 pf->pf_agg_node[node].num_vsis = 0; in ice_pf_dis_all_vsi()
498 pf->vf_agg_node[node].num_vsis = 0; in ice_pf_dis_all_vsi()
503 * @pf: board private structure
510 static void ice_clear_sw_switch_recipes(struct ice_pf *pf) in ice_clear_sw_switch_recipes() argument
515 recp = pf->hw.switch_info->recp_list; in ice_clear_sw_switch_recipes()
522 * @pf: board private structure
528 ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type) in ice_prepare_for_reset() argument
530 struct ice_hw *hw = &pf->hw; in ice_prepare_for_reset()
535 dev_dbg(ice_pf_to_dev(pf), "reset_type=%d\n", reset_type); in ice_prepare_for_reset()
538 if (test_bit(ICE_PREPARED_FOR_RESET, pf->state)) in ice_prepare_for_reset()
541 ice_unplug_aux_dev(pf); in ice_prepare_for_reset()
545 ice_vc_notify_reset(pf); in ice_prepare_for_reset()
548 mutex_lock(&pf->vfs.table_lock); in ice_prepare_for_reset()
549 ice_for_each_vf(pf, bkt, vf) in ice_prepare_for_reset()
551 mutex_unlock(&pf->vfs.table_lock); in ice_prepare_for_reset()
553 if (ice_is_eswitch_mode_switchdev(pf)) { in ice_prepare_for_reset()
555 ice_clear_sw_switch_recipes(pf); in ice_prepare_for_reset()
559 vsi = ice_get_main_vsi(pf); in ice_prepare_for_reset()
568 if (test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) { in ice_prepare_for_reset()
584 clear_bit(ICE_FLAG_TC_MQPRIO, pf->flags); in ice_prepare_for_reset()
593 ice_pf_dis_all_vsi(pf, false); in ice_prepare_for_reset()
595 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) in ice_prepare_for_reset()
596 ice_ptp_prepare_for_reset(pf); in ice_prepare_for_reset()
598 if (ice_is_feature_supported(pf, ICE_F_GNSS)) in ice_prepare_for_reset()
599 ice_gnss_exit(pf); in ice_prepare_for_reset()
606 set_bit(ICE_PREPARED_FOR_RESET, pf->state); in ice_prepare_for_reset()
611 * @pf: board private structure
614 static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type) in ice_do_reset() argument
616 struct device *dev = ice_pf_to_dev(pf); in ice_do_reset()
617 struct ice_hw *hw = &pf->hw; in ice_do_reset()
621 ice_prepare_for_reset(pf, reset_type); in ice_do_reset()
626 set_bit(ICE_RESET_FAILED, pf->state); in ice_do_reset()
627 clear_bit(ICE_RESET_OICR_RECV, pf->state); in ice_do_reset()
628 clear_bit(ICE_PREPARED_FOR_RESET, pf->state); in ice_do_reset()
629 clear_bit(ICE_PFR_REQ, pf->state); in ice_do_reset()
630 clear_bit(ICE_CORER_REQ, pf->state); in ice_do_reset()
631 clear_bit(ICE_GLOBR_REQ, pf->state); in ice_do_reset()
632 wake_up(&pf->reset_wait_queue); in ice_do_reset()
641 pf->pfr_count++; in ice_do_reset()
642 ice_rebuild(pf, reset_type); in ice_do_reset()
643 clear_bit(ICE_PREPARED_FOR_RESET, pf->state); in ice_do_reset()
644 clear_bit(ICE_PFR_REQ, pf->state); in ice_do_reset()
645 wake_up(&pf->reset_wait_queue); in ice_do_reset()
646 ice_reset_all_vfs(pf); in ice_do_reset()
652 * @pf: board private structure
654 static void ice_reset_subtask(struct ice_pf *pf) in ice_reset_subtask() argument
660 * of reset is pending and sets bits in pf->state indicating the reset in ice_reset_subtask()
662 * prepare for pending reset if not already (for PF software-initiated in ice_reset_subtask()
668 if (test_bit(ICE_RESET_OICR_RECV, pf->state)) { in ice_reset_subtask()
670 if (test_and_clear_bit(ICE_CORER_RECV, pf->state)) in ice_reset_subtask()
672 if (test_and_clear_bit(ICE_GLOBR_RECV, pf->state)) in ice_reset_subtask()
674 if (test_and_clear_bit(ICE_EMPR_RECV, pf->state)) in ice_reset_subtask()
679 ice_prepare_for_reset(pf, reset_type); in ice_reset_subtask()
682 if (ice_check_reset(&pf->hw)) { in ice_reset_subtask()
683 set_bit(ICE_RESET_FAILED, pf->state); in ice_reset_subtask()
686 pf->hw.reset_ongoing = false; in ice_reset_subtask()
687 ice_rebuild(pf, reset_type); in ice_reset_subtask()
691 clear_bit(ICE_RESET_OICR_RECV, pf->state); in ice_reset_subtask()
692 clear_bit(ICE_PREPARED_FOR_RESET, pf->state); in ice_reset_subtask()
693 clear_bit(ICE_PFR_REQ, pf->state); in ice_reset_subtask()
694 clear_bit(ICE_CORER_REQ, pf->state); in ice_reset_subtask()
695 clear_bit(ICE_GLOBR_REQ, pf->state); in ice_reset_subtask()
696 wake_up(&pf->reset_wait_queue); in ice_reset_subtask()
697 ice_reset_all_vfs(pf); in ice_reset_subtask()
704 if (test_bit(ICE_PFR_REQ, pf->state)) in ice_reset_subtask()
706 if (test_bit(ICE_CORER_REQ, pf->state)) in ice_reset_subtask()
708 if (test_bit(ICE_GLOBR_REQ, pf->state)) in ice_reset_subtask()
715 if (!test_bit(ICE_DOWN, pf->state) && in ice_reset_subtask()
716 !test_bit(ICE_CFG_BUSY, pf->state)) { in ice_reset_subtask()
717 ice_do_reset(pf, reset_type); in ice_reset_subtask()
910 * @pf: private PF struct
919 static void ice_set_dflt_mib(struct ice_pf *pf) in ice_set_dflt_mib() argument
921 struct device *dev = ice_pf_to_dev(pf); in ice_set_dflt_mib()
925 struct ice_hw *hw = &pf->hw; in ice_set_dflt_mib()
998 * @pf: pointer to PF struct
1003 static void ice_check_phy_fw_load(struct ice_pf *pf, u8 link_cfg_err) in ice_check_phy_fw_load() argument
1006 clear_bit(ICE_FLAG_PHY_FW_LOAD_FAILED, pf->flags); in ice_check_phy_fw_load()
1010 if (test_bit(ICE_FLAG_PHY_FW_LOAD_FAILED, pf->flags)) in ice_check_phy_fw_load()
1014 …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()
1015 set_bit(ICE_FLAG_PHY_FW_LOAD_FAILED, pf->flags); in ice_check_phy_fw_load()
1021 * @pf: pointer to PF struct
1027 static void ice_check_module_power(struct ice_pf *pf, u8 link_cfg_err) in ice_check_module_power() argument
1032 clear_bit(ICE_FLAG_MOD_POWER_UNSUPPORTED, pf->flags); in ice_check_module_power()
1039 if (test_bit(ICE_FLAG_MOD_POWER_UNSUPPORTED, pf->flags)) in ice_check_module_power()
1043 …dev_err(ice_pf_to_dev(pf), "The installed module is incompatible with the device's NVM image. Cann… in ice_check_module_power()
1044 set_bit(ICE_FLAG_MOD_POWER_UNSUPPORTED, pf->flags); in ice_check_module_power()
1046 …dev_err(ice_pf_to_dev(pf), "The module's power requirements exceed the device's power supply. Cann… in ice_check_module_power()
1047 set_bit(ICE_FLAG_MOD_POWER_UNSUPPORTED, pf->flags); in ice_check_module_power()
1053 * @pf: pointer to the PF struct
1059 static void ice_check_link_cfg_err(struct ice_pf *pf, u8 link_cfg_err) in ice_check_link_cfg_err() argument
1061 ice_check_module_power(pf, link_cfg_err); in ice_check_link_cfg_err()
1062 ice_check_phy_fw_load(pf, link_cfg_err); in ice_check_link_cfg_err()
1067 * @pf: PF that the link event is associated with
1075 ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up, in ice_link_event() argument
1078 struct device *dev = ice_pf_to_dev(pf); in ice_link_event()
1100 ice_check_link_cfg_err(pf, pi->phy.link_info.link_cfg_err); in ice_link_event()
1108 vsi = ice_get_main_vsi(pf); in ice_link_event()
1113 if (!test_bit(ICE_FLAG_NO_MEDIA, pf->flags) && in ice_link_event()
1115 set_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_link_event()
1123 if (!ice_is_e810(&pf->hw)) in ice_link_event()
1124 ice_ptp_link_change(pf, pf->hw.pf_id, link_up); in ice_link_event()
1126 if (ice_is_dcb_active(pf)) { in ice_link_event()
1127 if (test_bit(ICE_FLAG_DCB_ENA, pf->flags)) in ice_link_event()
1128 ice_dcb_rebuild(pf); in ice_link_event()
1131 ice_set_dflt_mib(pf); in ice_link_event()
1136 ice_vc_notify_link_state(pf); in ice_link_event()
1143 * @pf: board private structure
1145 static void ice_watchdog_subtask(struct ice_pf *pf) in ice_watchdog_subtask() argument
1150 if (test_bit(ICE_DOWN, pf->state) || in ice_watchdog_subtask()
1151 test_bit(ICE_CFG_BUSY, pf->state)) in ice_watchdog_subtask()
1156 pf->serv_tmr_prev + pf->serv_tmr_period)) in ice_watchdog_subtask()
1159 pf->serv_tmr_prev = jiffies; in ice_watchdog_subtask()
1164 ice_update_pf_stats(pf); in ice_watchdog_subtask()
1165 ice_for_each_vsi(pf, i) in ice_watchdog_subtask()
1166 if (pf->vsi[i] && pf->vsi[i]->netdev) in ice_watchdog_subtask()
1167 ice_update_vsi_stats(pf->vsi[i]); in ice_watchdog_subtask()
1201 * @pf: PF that the link event is associated with
1205 ice_handle_link_event(struct ice_pf *pf, struct ice_rq_event_info *event) in ice_handle_link_event() argument
1212 port_info = pf->hw.port_info; in ice_handle_link_event()
1216 status = ice_link_event(pf, port_info, in ice_handle_link_event()
1220 dev_dbg(ice_pf_to_dev(pf), "Could not process link event, error %d\n", in ice_handle_link_event()
1242 * @pf: pointer to the PF private structure
1247 * Waits for a specific AdminQ completion event on the ARQ for a given PF. The
1257 int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, in ice_aq_wait_for_event() argument
1260 struct device *dev = ice_pf_to_dev(pf); in ice_aq_wait_for_event()
1275 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1276 hlist_add_head(&task->entry, &pf->aq_wait_list); in ice_aq_wait_for_event()
1277 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1281 ret = wait_event_interruptible_timeout(pf->aq_wait_queue, task->state, in ice_aq_wait_for_event()
1304 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1306 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_wait_for_event()
1314 * @pf: pointer to the PF private structure
1330 static void ice_aq_check_events(struct ice_pf *pf, u16 opcode, in ice_aq_check_events() argument
1336 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_check_events()
1337 hlist_for_each_entry(task, &pf->aq_wait_list, entry) { in ice_aq_check_events()
1355 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_check_events()
1358 wake_up(&pf->aq_wait_queue); in ice_aq_check_events()
1363 * @pf: the PF private structure
1368 static void ice_aq_cancel_waiting_tasks(struct ice_pf *pf) in ice_aq_cancel_waiting_tasks() argument
1372 spin_lock_bh(&pf->aq_wait_lock); in ice_aq_cancel_waiting_tasks()
1373 hlist_for_each_entry(task, &pf->aq_wait_list, entry) in ice_aq_cancel_waiting_tasks()
1375 spin_unlock_bh(&pf->aq_wait_lock); in ice_aq_cancel_waiting_tasks()
1377 wake_up(&pf->aq_wait_queue); in ice_aq_cancel_waiting_tasks()
1382 * @pf: ptr to struct ice_pf
1385 static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type) in __ice_clean_ctrlq() argument
1387 struct device *dev = ice_pf_to_dev(pf); in __ice_clean_ctrlq()
1389 struct ice_hw *hw = &pf->hw; in __ice_clean_ctrlq()
1395 /* Do not clean control queue if/when PF reset fails */ in __ice_clean_ctrlq()
1396 if (test_bit(ICE_RESET_FAILED, pf->state)) in __ice_clean_ctrlq()
1485 ice_aq_check_events(pf, opcode, &event); in __ice_clean_ctrlq()
1489 if (ice_handle_link_event(pf, &event)) in __ice_clean_ctrlq()
1493 ice_vf_lan_overflow_event(pf, &event); in __ice_clean_ctrlq()
1496 if (!ice_is_malicious_vf(pf, &event, i, pending)) in __ice_clean_ctrlq()
1497 ice_vc_process_vf_msg(pf, &event); in __ice_clean_ctrlq()
1503 ice_dcb_process_lldp_set_mib_change(pf, &event); in __ice_clean_ctrlq()
1534 * @pf: board private structure
1536 static void ice_clean_adminq_subtask(struct ice_pf *pf) in ice_clean_adminq_subtask() argument
1538 struct ice_hw *hw = &pf->hw; in ice_clean_adminq_subtask()
1540 if (!test_bit(ICE_ADMINQ_EVENT_PENDING, pf->state)) in ice_clean_adminq_subtask()
1543 if (__ice_clean_ctrlq(pf, ICE_CTL_Q_ADMIN)) in ice_clean_adminq_subtask()
1546 clear_bit(ICE_ADMINQ_EVENT_PENDING, pf->state); in ice_clean_adminq_subtask()
1554 __ice_clean_ctrlq(pf, ICE_CTL_Q_ADMIN); in ice_clean_adminq_subtask()
1561 * @pf: board private structure
1563 static void ice_clean_mailboxq_subtask(struct ice_pf *pf) in ice_clean_mailboxq_subtask() argument
1565 struct ice_hw *hw = &pf->hw; in ice_clean_mailboxq_subtask()
1567 if (!test_bit(ICE_MAILBOXQ_EVENT_PENDING, pf->state)) in ice_clean_mailboxq_subtask()
1570 if (__ice_clean_ctrlq(pf, ICE_CTL_Q_MAILBOX)) in ice_clean_mailboxq_subtask()
1573 clear_bit(ICE_MAILBOXQ_EVENT_PENDING, pf->state); in ice_clean_mailboxq_subtask()
1576 __ice_clean_ctrlq(pf, ICE_CTL_Q_MAILBOX); in ice_clean_mailboxq_subtask()
1583 * @pf: board private structure
1585 static void ice_clean_sbq_subtask(struct ice_pf *pf) in ice_clean_sbq_subtask() argument
1587 struct ice_hw *hw = &pf->hw; in ice_clean_sbq_subtask()
1591 clear_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state); in ice_clean_sbq_subtask()
1595 if (!test_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state)) in ice_clean_sbq_subtask()
1598 if (__ice_clean_ctrlq(pf, ICE_CTL_Q_SB)) in ice_clean_sbq_subtask()
1601 clear_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state); in ice_clean_sbq_subtask()
1604 __ice_clean_ctrlq(pf, ICE_CTL_Q_SB); in ice_clean_sbq_subtask()
1611 * @pf: board private structure
1615 void ice_service_task_schedule(struct ice_pf *pf) in ice_service_task_schedule() argument
1617 if (!test_bit(ICE_SERVICE_DIS, pf->state) && in ice_service_task_schedule()
1618 !test_and_set_bit(ICE_SERVICE_SCHED, pf->state) && in ice_service_task_schedule()
1619 !test_bit(ICE_NEEDS_RESTART, pf->state)) in ice_service_task_schedule()
1620 queue_work(ice_wq, &pf->serv_task); in ice_service_task_schedule()
1625 * @pf: board private structure
1627 static void ice_service_task_complete(struct ice_pf *pf) in ice_service_task_complete() argument
1629 WARN_ON(!test_bit(ICE_SERVICE_SCHED, pf->state)); in ice_service_task_complete()
1631 /* force memory (pf->state) to sync before next service task */ in ice_service_task_complete()
1633 clear_bit(ICE_SERVICE_SCHED, pf->state); in ice_service_task_complete()
1638 * @pf: board private structure
1643 static int ice_service_task_stop(struct ice_pf *pf) in ice_service_task_stop() argument
1647 ret = test_and_set_bit(ICE_SERVICE_DIS, pf->state); in ice_service_task_stop()
1649 if (pf->serv_tmr.function) in ice_service_task_stop()
1650 del_timer_sync(&pf->serv_tmr); in ice_service_task_stop()
1651 if (pf->serv_task.func) in ice_service_task_stop()
1652 cancel_work_sync(&pf->serv_task); in ice_service_task_stop()
1654 clear_bit(ICE_SERVICE_SCHED, pf->state); in ice_service_task_stop()
1660 * @pf: board private structure
1664 static void ice_service_task_restart(struct ice_pf *pf) in ice_service_task_restart() argument
1666 clear_bit(ICE_SERVICE_DIS, pf->state); in ice_service_task_restart()
1667 ice_service_task_schedule(pf); in ice_service_task_restart()
1676 struct ice_pf *pf = from_timer(pf, t, serv_tmr); in ice_service_timer() local
1678 mod_timer(&pf->serv_tmr, round_jiffies(pf->serv_tmr_period + jiffies)); in ice_service_timer()
1679 ice_service_task_schedule(pf); in ice_service_timer()
1684 * @pf: pointer to the PF structure
1687 * VF MDD logging is guarded by net_ratelimit. Additional PF and VF log
1689 * disable the queue, the PF can be configured to reset the VF using ethtool
1692 static void ice_handle_mdd_event(struct ice_pf *pf) in ice_handle_mdd_event() argument
1694 struct device *dev = ice_pf_to_dev(pf); in ice_handle_mdd_event()
1695 struct ice_hw *hw = &pf->hw; in ice_handle_mdd_event()
1700 if (!test_and_clear_bit(ICE_MDD_EVENT_PENDING, pf->state)) { in ice_handle_mdd_event()
1704 ice_print_vfs_mdd_events(pf); in ice_handle_mdd_event()
1720 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1721 dev_info(dev, "Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\n", in ice_handle_mdd_event()
1737 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1738 dev_info(dev, "Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\n", in ice_handle_mdd_event()
1754 if (netif_msg_rx_err(pf)) in ice_handle_mdd_event()
1755 dev_info(dev, "Malicious Driver Detection event %d on RX queue %d PF# %d VF# %d\n", in ice_handle_mdd_event()
1760 /* check to see if this PF caused an MDD event */ in ice_handle_mdd_event()
1764 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1765 dev_info(dev, "Malicious Driver Detection event TX_PQM detected on PF\n"); in ice_handle_mdd_event()
1771 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1772 dev_info(dev, "Malicious Driver Detection event TX_TCLAN detected on PF\n"); in ice_handle_mdd_event()
1778 if (netif_msg_rx_err(pf)) in ice_handle_mdd_event()
1779 dev_info(dev, "Malicious Driver Detection event RX detected on PF\n"); in ice_handle_mdd_event()
1785 mutex_lock(&pf->vfs.table_lock); in ice_handle_mdd_event()
1786 ice_for_each_vf(pf, bkt, vf) { in ice_handle_mdd_event()
1791 set_bit(ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1792 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1801 set_bit(ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1802 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1811 set_bit(ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1812 if (netif_msg_tx_err(pf)) in ice_handle_mdd_event()
1821 set_bit(ICE_MDD_VF_PRINT_PENDING, pf->state); in ice_handle_mdd_event()
1822 if (netif_msg_rx_err(pf)) in ice_handle_mdd_event()
1827 * PF can be configured to reset the VF through ethtool in ice_handle_mdd_event()
1830 if (test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)) { in ice_handle_mdd_event()
1839 mutex_unlock(&pf->vfs.table_lock); in ice_handle_mdd_event()
1841 ice_print_vfs_mdd_events(pf); in ice_handle_mdd_event()
1929 struct ice_pf *pf = pi->hw->back; in ice_init_nvm_phy_type() local
1940 dev_err(ice_pf_to_dev(pf), "Get PHY capability failed.\n"); in ice_init_nvm_phy_type()
1944 pf->nvm_phy_type_hi = pcaps->phy_type_high; in ice_init_nvm_phy_type()
1945 pf->nvm_phy_type_lo = pcaps->phy_type_low; in ice_init_nvm_phy_type()
1961 struct ice_pf *pf = pi->hw->back; in ice_init_link_dflt_override() local
1963 ldo = &pf->link_dflt_override; in ice_init_link_dflt_override()
1973 set_bit(ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA, pf->flags); in ice_init_link_dflt_override()
1974 set_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags); in ice_init_link_dflt_override()
1999 struct ice_pf *pf = pi->hw->back; in ice_init_phy_cfg_dflt_override() local
2001 ldo = &pf->link_dflt_override; in ice_init_phy_cfg_dflt_override()
2009 cfg->phy_type_low = pf->nvm_phy_type_lo & in ice_init_phy_cfg_dflt_override()
2011 cfg->phy_type_high = pf->nvm_phy_type_hi & in ice_init_phy_cfg_dflt_override()
2017 set_bit(ICE_LINK_DEFAULT_OVERRIDE_PENDING, pf->state); in ice_init_phy_cfg_dflt_override()
2038 struct ice_pf *pf = pi->hw->back; in ice_init_phy_user_cfg() local
2055 dev_err(ice_pf_to_dev(pf), "Get PHY capability failed.\n"); in ice_init_phy_user_cfg()
2065 set_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags); in ice_init_phy_user_cfg()
2072 (pf->link_dflt_override.options & ICE_LINK_OVERRIDE_EN)) { in ice_init_phy_user_cfg()
2087 set_bit(ICE_PHY_INIT_COMPLETE, pf->state); in ice_init_phy_user_cfg()
2108 struct ice_pf *pf = vsi->back; in ice_configure_phy() local
2117 if (!test_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags) && in ice_configure_phy()
2121 if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags)) in ice_configure_phy()
2207 err = ice_aq_set_phy_cfg(&pf->hw, pi, cfg, NULL); in ice_configure_phy()
2220 * @pf: pointer to PF struct
2225 static void ice_check_media_subtask(struct ice_pf *pf) in ice_check_media_subtask() argument
2232 if (!test_bit(ICE_FLAG_NO_MEDIA, pf->flags)) in ice_check_media_subtask()
2235 vsi = ice_get_main_vsi(pf); in ice_check_media_subtask()
2245 ice_check_link_cfg_err(pf, pi->phy.link_info.link_cfg_err); in ice_check_media_subtask()
2248 if (!test_bit(ICE_PHY_INIT_COMPLETE, pf->state)) in ice_check_media_subtask()
2260 clear_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_check_media_subtask()
2270 * @work: pointer to work_struct contained by the PF struct
2274 struct ice_pf *pf = container_of(work, struct ice_pf, serv_task); in ice_service_task() local
2280 ice_reset_subtask(pf); in ice_service_task()
2283 if (ice_is_reset_in_progress(pf->state) || in ice_service_task()
2284 test_bit(ICE_SUSPENDED, pf->state) || in ice_service_task()
2285 test_bit(ICE_NEEDS_RESTART, pf->state)) { in ice_service_task()
2286 ice_service_task_complete(pf); in ice_service_task()
2290 if (test_and_clear_bit(ICE_AUX_ERR_PENDING, pf->state)) { in ice_service_task()
2297 swap(event->reg, pf->oicr_err_reg); in ice_service_task()
2298 ice_send_event_to_aux(pf, event); in ice_service_task()
2303 if (test_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags)) { in ice_service_task()
2305 ice_plug_aux_dev(pf); in ice_service_task()
2312 if (!test_and_clear_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags)) in ice_service_task()
2313 ice_unplug_aux_dev(pf); in ice_service_task()
2316 if (test_and_clear_bit(ICE_FLAG_MTU_CHANGED, pf->flags)) { in ice_service_task()
2322 ice_send_event_to_aux(pf, event); in ice_service_task()
2327 ice_clean_adminq_subtask(pf); in ice_service_task()
2328 ice_check_media_subtask(pf); in ice_service_task()
2329 ice_check_for_hang_subtask(pf); in ice_service_task()
2330 ice_sync_fltr_subtask(pf); in ice_service_task()
2331 ice_handle_mdd_event(pf); in ice_service_task()
2332 ice_watchdog_subtask(pf); in ice_service_task()
2334 if (ice_is_safe_mode(pf)) { in ice_service_task()
2335 ice_service_task_complete(pf); in ice_service_task()
2339 ice_process_vflr_event(pf); in ice_service_task()
2340 ice_clean_mailboxq_subtask(pf); in ice_service_task()
2341 ice_clean_sbq_subtask(pf); in ice_service_task()
2342 ice_sync_arfs_fltrs(pf); in ice_service_task()
2343 ice_flush_fdir_ctx(pf); in ice_service_task()
2346 ice_service_task_complete(pf); in ice_service_task()
2352 if (time_after(jiffies, (start_time + pf->serv_tmr_period)) || in ice_service_task()
2353 test_bit(ICE_MDD_EVENT_PENDING, pf->state) || in ice_service_task()
2354 test_bit(ICE_VFLR_EVENT_PENDING, pf->state) || in ice_service_task()
2355 test_bit(ICE_MAILBOXQ_EVENT_PENDING, pf->state) || in ice_service_task()
2356 test_bit(ICE_FD_VF_FLUSH_CTX, pf->state) || in ice_service_task()
2357 test_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state) || in ice_service_task()
2358 test_bit(ICE_ADMINQ_EVENT_PENDING, pf->state)) in ice_service_task()
2359 mod_timer(&pf->serv_tmr, jiffies); in ice_service_task()
2384 * @pf: board private structure
2387 int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset) in ice_schedule_reset() argument
2389 struct device *dev = ice_pf_to_dev(pf); in ice_schedule_reset()
2392 if (test_bit(ICE_RESET_FAILED, pf->state)) { in ice_schedule_reset()
2397 if (ice_is_reset_in_progress(pf->state)) { in ice_schedule_reset()
2404 set_bit(ICE_PFR_REQ, pf->state); in ice_schedule_reset()
2407 set_bit(ICE_CORER_REQ, pf->state); in ice_schedule_reset()
2410 set_bit(ICE_GLOBR_REQ, pf->state); in ice_schedule_reset()
2416 ice_service_task_schedule(pf); in ice_schedule_reset()
2472 struct ice_pf *pf = vsi->back; in ice_vsi_req_irq_msix() local
2480 dev = ice_pf_to_dev(pf); in ice_vsi_req_irq_msix()
2484 irq_num = pf->msix_entries[base + vector].vector; in ice_vsi_req_irq_msix()
2540 irq_num = pf->msix_entries[base + vector].vector; in ice_vsi_req_irq_msix()
2627 struct ice_pf *pf = vsi->back; in ice_prepare_xdp_rings() local
2629 .qs_mutex = &pf->avail_q_mutex, in ice_prepare_xdp_rings()
2630 .pf_map = pf->avail_txqs, in ice_prepare_xdp_rings()
2631 .pf_map_size = pf->max_pf_txqs, in ice_prepare_xdp_rings()
2642 dev = ice_pf_to_dev(pf); in ice_prepare_xdp_rings()
2699 if (ice_is_reset_in_progress(pf->state)) in ice_prepare_xdp_rings()
2737 mutex_lock(&pf->avail_q_mutex); in ice_prepare_xdp_rings()
2739 clear_bit(vsi->txq_map[i + vsi->alloc_txq], pf->avail_txqs); in ice_prepare_xdp_rings()
2742 mutex_unlock(&pf->avail_q_mutex); in ice_prepare_xdp_rings()
2752 * Detach XDP rings from irq vectors, clean up the PF bitmap and free
2758 struct ice_pf *pf = vsi->back; in ice_destroy_xdp_rings() local
2763 * in pf->state won't be set, so additionally check first q_vector in ice_destroy_xdp_rings()
2766 if (ice_is_reset_in_progress(pf->state) || !vsi->q_vectors[0]) in ice_destroy_xdp_rings()
2782 mutex_lock(&pf->avail_q_mutex); in ice_destroy_xdp_rings()
2784 clear_bit(vsi->txq_map[i + vsi->alloc_txq], pf->avail_txqs); in ice_destroy_xdp_rings()
2787 mutex_unlock(&pf->avail_q_mutex); in ice_destroy_xdp_rings()
2799 devm_kfree(ice_pf_to_dev(pf), vsi->xdp_rings); in ice_destroy_xdp_rings()
2805 if (ice_is_reset_in_progress(pf->state) || !vsi->q_vectors[0]) in ice_destroy_xdp_rings()
2954 NL_SET_ERR_MSG_MOD(xdp->extack, "XDP can be loaded only on PF VSI"); in ice_xdp()
2971 * @pf: board private structure
2973 static void ice_ena_misc_vector(struct ice_pf *pf) in ice_ena_misc_vector() argument
2975 struct ice_hw *hw = &pf->hw; in ice_ena_misc_vector()
3002 wr32(hw, GLINT_DYN_CTL(pf->oicr_idx), in ice_ena_misc_vector()
3013 struct ice_pf *pf = (struct ice_pf *)data; in ice_misc_intr() local
3014 struct ice_hw *hw = &pf->hw; in ice_misc_intr()
3019 dev = ice_pf_to_dev(pf); in ice_misc_intr()
3020 set_bit(ICE_ADMINQ_EVENT_PENDING, pf->state); in ice_misc_intr()
3021 set_bit(ICE_MAILBOXQ_EVENT_PENDING, pf->state); in ice_misc_intr()
3022 set_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state); in ice_misc_intr()
3029 pf->sw_int_count++; in ice_misc_intr()
3034 set_bit(ICE_MDD_EVENT_PENDING, pf->state); in ice_misc_intr()
3038 if (test_bit(ICE_VF_RESETS_DISABLED, pf->state)) { in ice_misc_intr()
3045 set_bit(ICE_VFLR_EVENT_PENDING, pf->state); in ice_misc_intr()
3058 pf->corer_count++; in ice_misc_intr()
3060 pf->globr_count++; in ice_misc_intr()
3062 pf->empr_count++; in ice_misc_intr()
3067 * pf->state so that the service task can start a reset/rebuild. in ice_misc_intr()
3069 if (!test_and_set_bit(ICE_RESET_OICR_RECV, pf->state)) { in ice_misc_intr()
3071 set_bit(ICE_CORER_RECV, pf->state); in ice_misc_intr()
3073 set_bit(ICE_GLOBR_RECV, pf->state); in ice_misc_intr()
3075 set_bit(ICE_EMPR_RECV, pf->state); in ice_misc_intr()
3083 * ICE_RESET_OICR_RECV in pf->state indicates in ice_misc_intr()
3105 pf->ptp.ext_ts_irq |= gltsyn_stat & (GLTSYN_STAT_EVENT0_M | in ice_misc_intr()
3109 kthread_queue_work(pf->ptp.kworker, &pf->ptp.extts_work); in ice_misc_intr()
3114 pf->oicr_err_reg |= oicr; in ice_misc_intr()
3115 set_bit(ICE_AUX_ERR_PENDING, pf->state); in ice_misc_intr()
3128 set_bit(ICE_PFR_REQ, pf->state); in ice_misc_intr()
3129 ice_service_task_schedule(pf); in ice_misc_intr()
3135 ice_service_task_schedule(pf); in ice_misc_intr()
3148 struct ice_pf *pf = data; in ice_misc_intr_thread_fn() local
3150 if (ice_is_reset_in_progress(pf->state)) in ice_misc_intr_thread_fn()
3153 while (!ice_ptp_process_ts(pf)) in ice_misc_intr_thread_fn()
3185 * @pf: board private structure
3187 static void ice_free_irq_msix_misc(struct ice_pf *pf) in ice_free_irq_msix_misc() argument
3189 struct ice_hw *hw = &pf->hw; in ice_free_irq_msix_misc()
3197 if (pf->msix_entries) { in ice_free_irq_msix_misc()
3198 synchronize_irq(pf->msix_entries[pf->oicr_idx].vector); in ice_free_irq_msix_misc()
3199 devm_free_irq(ice_pf_to_dev(pf), in ice_free_irq_msix_misc()
3200 pf->msix_entries[pf->oicr_idx].vector, pf); in ice_free_irq_msix_misc()
3203 pf->num_avail_sw_msix += 1; in ice_free_irq_msix_misc()
3204 ice_free_res(pf->irq_tracker, pf->oicr_idx, ICE_RES_MISC_VEC_ID); in ice_free_irq_msix_misc()
3240 * @pf: board private structure
3246 static int ice_req_irq_msix_misc(struct ice_pf *pf) in ice_req_irq_msix_misc() argument
3248 struct device *dev = ice_pf_to_dev(pf); in ice_req_irq_msix_misc()
3249 struct ice_hw *hw = &pf->hw; in ice_req_irq_msix_misc()
3252 if (!pf->int_name[0]) in ice_req_irq_msix_misc()
3253 snprintf(pf->int_name, sizeof(pf->int_name) - 1, "%s-%s:misc", in ice_req_irq_msix_misc()
3260 if (ice_is_reset_in_progress(pf->state)) in ice_req_irq_msix_misc()
3264 oicr_idx = ice_get_res(pf, pf->irq_tracker, 1, ICE_RES_MISC_VEC_ID); in ice_req_irq_msix_misc()
3268 pf->num_avail_sw_msix -= 1; in ice_req_irq_msix_misc()
3269 pf->oicr_idx = (u16)oicr_idx; in ice_req_irq_msix_misc()
3272 pf->msix_entries[pf->oicr_idx].vector, in ice_req_irq_msix_misc()
3274 0, pf->int_name, pf); in ice_req_irq_msix_misc()
3277 pf->int_name, err); in ice_req_irq_msix_misc()
3278 ice_free_res(pf->irq_tracker, 1, ICE_RES_MISC_VEC_ID); in ice_req_irq_msix_misc()
3279 pf->num_avail_sw_msix += 1; in ice_req_irq_msix_misc()
3284 ice_ena_misc_vector(pf); in ice_req_irq_msix_misc()
3286 ice_ena_ctrlq_interrupts(hw, pf->oicr_idx); in ice_req_irq_msix_misc()
3287 wr32(hw, GLINT_ITR(ICE_RX_ITR, pf->oicr_idx), in ice_req_irq_msix_misc()
3322 struct ice_pf *pf = ice_netdev_to_pf(netdev); in ice_set_ops() local
3324 if (ice_is_safe_mode(pf)) { in ice_set_ops()
3331 netdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic; in ice_set_ops()
3341 struct ice_pf *pf = ice_netdev_to_pf(netdev); in ice_set_netdev_features() local
3342 bool is_dvm_ena = ice_is_dvm_ena(&pf->hw); in ice_set_netdev_features()
3348 if (ice_is_safe_mode(pf)) { in ice_set_netdev_features()
3485 * ice_pf_vsi_setup - Set up a PF VSI
3486 * @pf: board private structure
3493 ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_pf_vsi_setup() argument
3495 return ice_vsi_setup(pf, pi, ICE_VSI_PF, NULL, NULL); in ice_pf_vsi_setup()
3499 ice_chnl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, in ice_chnl_vsi_setup() argument
3502 return ice_vsi_setup(pf, pi, ICE_VSI_CHNL, NULL, ch); in ice_chnl_vsi_setup()
3507 * @pf: board private structure
3514 ice_ctrl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_ctrl_vsi_setup() argument
3516 return ice_vsi_setup(pf, pi, ICE_VSI_CTRL, NULL, NULL); in ice_ctrl_vsi_setup()
3521 * @pf: board private structure
3528 ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_lb_vsi_setup() argument
3530 return ice_vsi_setup(pf, pi, ICE_VSI_LB, NULL, NULL); in ice_lb_vsi_setup()
3691 * @pf: PF structure
3693 static void ice_tc_indir_block_remove(struct ice_pf *pf) in ice_tc_indir_block_remove() argument
3695 struct ice_vsi *pf_vsi = ice_get_main_vsi(pf); in ice_tc_indir_block_remove()
3724 * @pf: board private structure
3728 static int ice_setup_pf_sw(struct ice_pf *pf) in ice_setup_pf_sw() argument
3730 struct device *dev = ice_pf_to_dev(pf); in ice_setup_pf_sw()
3731 bool dvm = ice_is_dvm_ena(&pf->hw); in ice_setup_pf_sw()
3735 if (ice_is_reset_in_progress(pf->state)) in ice_setup_pf_sw()
3738 status = ice_aq_set_port_params(pf->hw.port_info, dvm, NULL); in ice_setup_pf_sw()
3742 vsi = ice_pf_vsi_setup(pf, pf->hw.port_info); in ice_setup_pf_sw()
3771 status = ice_init_mac_fltr(pf); in ice_setup_pf_sw()
3816 * @pf: pointer to an ice_pf instance
3818 u16 ice_get_avail_txq_count(struct ice_pf *pf) in ice_get_avail_txq_count() argument
3820 return ice_get_avail_q_count(pf->avail_txqs, &pf->avail_q_mutex, in ice_get_avail_txq_count()
3821 pf->max_pf_txqs); in ice_get_avail_txq_count()
3826 * @pf: pointer to an ice_pf instance
3828 u16 ice_get_avail_rxq_count(struct ice_pf *pf) in ice_get_avail_rxq_count() argument
3830 return ice_get_avail_q_count(pf->avail_rxqs, &pf->avail_q_mutex, in ice_get_avail_rxq_count()
3831 pf->max_pf_rxqs); in ice_get_avail_rxq_count()
3836 * @pf: board private structure to initialize
3838 static void ice_deinit_pf(struct ice_pf *pf) in ice_deinit_pf() argument
3840 ice_service_task_stop(pf); in ice_deinit_pf()
3841 mutex_destroy(&pf->adev_mutex); in ice_deinit_pf()
3842 mutex_destroy(&pf->sw_mutex); in ice_deinit_pf()
3843 mutex_destroy(&pf->tc_mutex); in ice_deinit_pf()
3844 mutex_destroy(&pf->avail_q_mutex); in ice_deinit_pf()
3845 mutex_destroy(&pf->vfs.table_lock); in ice_deinit_pf()
3847 if (pf->avail_txqs) { in ice_deinit_pf()
3848 bitmap_free(pf->avail_txqs); in ice_deinit_pf()
3849 pf->avail_txqs = NULL; in ice_deinit_pf()
3852 if (pf->avail_rxqs) { in ice_deinit_pf()
3853 bitmap_free(pf->avail_rxqs); in ice_deinit_pf()
3854 pf->avail_rxqs = NULL; in ice_deinit_pf()
3857 if (pf->ptp.clock) in ice_deinit_pf()
3858 ptp_clock_unregister(pf->ptp.clock); in ice_deinit_pf()
3863 * @pf: pointer to the PF instance
3865 static void ice_set_pf_caps(struct ice_pf *pf) in ice_set_pf_caps() argument
3867 struct ice_hw_func_caps *func_caps = &pf->hw.func_caps; in ice_set_pf_caps()
3869 clear_bit(ICE_FLAG_RDMA_ENA, pf->flags); in ice_set_pf_caps()
3871 set_bit(ICE_FLAG_RDMA_ENA, pf->flags); in ice_set_pf_caps()
3872 clear_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); in ice_set_pf_caps()
3874 set_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); in ice_set_pf_caps()
3875 clear_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags); in ice_set_pf_caps()
3877 set_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags); in ice_set_pf_caps()
3878 pf->vfs.num_supported = min_t(int, func_caps->num_allocd_vfs, in ice_set_pf_caps()
3881 clear_bit(ICE_FLAG_RSS_ENA, pf->flags); in ice_set_pf_caps()
3883 set_bit(ICE_FLAG_RSS_ENA, pf->flags); in ice_set_pf_caps()
3885 clear_bit(ICE_FLAG_FD_ENA, pf->flags); in ice_set_pf_caps()
3892 pf->ctrl_vsi_idx = ICE_NO_VSI; in ice_set_pf_caps()
3893 set_bit(ICE_FLAG_FD_ENA, pf->flags); in ice_set_pf_caps()
3894 /* force guaranteed filter pool for PF */ in ice_set_pf_caps()
3895 ice_alloc_fd_guar_item(&pf->hw, &unused, in ice_set_pf_caps()
3897 /* force shared filter pool for PF */ in ice_set_pf_caps()
3898 ice_alloc_fd_shrd_item(&pf->hw, &unused, in ice_set_pf_caps()
3902 clear_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags); in ice_set_pf_caps()
3904 set_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags); in ice_set_pf_caps()
3906 pf->max_pf_txqs = func_caps->common_cap.num_txq; in ice_set_pf_caps()
3907 pf->max_pf_rxqs = func_caps->common_cap.num_rxq; in ice_set_pf_caps()
3912 * @pf: board private structure to initialize
3914 static int ice_init_pf(struct ice_pf *pf) in ice_init_pf() argument
3916 ice_set_pf_caps(pf); in ice_init_pf()
3918 mutex_init(&pf->sw_mutex); in ice_init_pf()
3919 mutex_init(&pf->tc_mutex); in ice_init_pf()
3920 mutex_init(&pf->adev_mutex); in ice_init_pf()
3922 INIT_HLIST_HEAD(&pf->aq_wait_list); in ice_init_pf()
3923 spin_lock_init(&pf->aq_wait_lock); in ice_init_pf()
3924 init_waitqueue_head(&pf->aq_wait_queue); in ice_init_pf()
3926 init_waitqueue_head(&pf->reset_wait_queue); in ice_init_pf()
3929 timer_setup(&pf->serv_tmr, ice_service_timer, 0); in ice_init_pf()
3930 pf->serv_tmr_period = HZ; in ice_init_pf()
3931 INIT_WORK(&pf->serv_task, ice_service_task); in ice_init_pf()
3932 clear_bit(ICE_SERVICE_SCHED, pf->state); in ice_init_pf()
3934 mutex_init(&pf->avail_q_mutex); in ice_init_pf()
3935 pf->avail_txqs = bitmap_zalloc(pf->max_pf_txqs, GFP_KERNEL); in ice_init_pf()
3936 if (!pf->avail_txqs) in ice_init_pf()
3939 pf->avail_rxqs = bitmap_zalloc(pf->max_pf_rxqs, GFP_KERNEL); in ice_init_pf()
3940 if (!pf->avail_rxqs) { in ice_init_pf()
3941 bitmap_free(pf->avail_txqs); in ice_init_pf()
3942 pf->avail_txqs = NULL; in ice_init_pf()
3946 mutex_init(&pf->vfs.table_lock); in ice_init_pf()
3947 hash_init(pf->vfs.table); in ice_init_pf()
3954 * @pf: board private structure
3958 * pf->num_lan_msix and pf->num_rdma_msix values are set based on number of
3961 static void ice_reduce_msix_usage(struct ice_pf *pf, int v_remain) in ice_reduce_msix_usage() argument
3965 if (!ice_is_rdma_ena(pf)) { in ice_reduce_msix_usage()
3966 pf->num_lan_msix = v_remain; in ice_reduce_msix_usage()
3974 dev_warn(ice_pf_to_dev(pf), "Not enough MSI-X vectors to support RDMA.\n"); in ice_reduce_msix_usage()
3975 clear_bit(ICE_FLAG_RDMA_ENA, pf->flags); in ice_reduce_msix_usage()
3977 pf->num_rdma_msix = 0; in ice_reduce_msix_usage()
3978 pf->num_lan_msix = ICE_MIN_LAN_TXRX_MSIX; in ice_reduce_msix_usage()
3982 pf->num_rdma_msix = ICE_MIN_RDMA_MSIX; in ice_reduce_msix_usage()
3983 pf->num_lan_msix = v_remain - ICE_MIN_RDMA_MSIX; in ice_reduce_msix_usage()
3987 pf->num_rdma_msix = (v_remain - ICE_RDMA_NUM_AEQ_MSIX) / 2 + in ice_reduce_msix_usage()
3989 pf->num_lan_msix = v_remain - pf->num_rdma_msix; in ice_reduce_msix_usage()
3995 * @pf: board private structure
4001 static int ice_ena_msix_range(struct ice_pf *pf) in ice_ena_msix_range() argument
4004 struct device *dev = ice_pf_to_dev(pf); in ice_ena_msix_range()
4007 hw_num_msix = pf->hw.func_caps.common_cap.num_msix_vectors; in ice_ena_msix_range()
4014 if (test_bit(ICE_FLAG_FD_ENA, pf->flags)) in ice_ena_msix_range()
4023 pf->num_lan_msix = num_cpus; in ice_ena_msix_range()
4024 v_wanted += pf->num_lan_msix; in ice_ena_msix_range()
4027 if (ice_is_rdma_ena(pf)) { in ice_ena_msix_range()
4028 pf->num_rdma_msix = num_cpus + ICE_RDMA_NUM_AEQ_MSIX; in ice_ena_msix_range()
4029 v_wanted += pf->num_rdma_msix; in ice_ena_msix_range()
4049 ice_reduce_msix_usage(pf, v_remain); in ice_ena_msix_range()
4050 v_wanted = pf->num_lan_msix + pf->num_rdma_msix + v_other; in ice_ena_msix_range()
4053 pf->num_lan_msix); in ice_ena_msix_range()
4054 if (ice_is_rdma_ena(pf)) in ice_ena_msix_range()
4056 pf->num_rdma_msix); in ice_ena_msix_range()
4059 pf->msix_entries = devm_kcalloc(dev, v_wanted, in ice_ena_msix_range()
4060 sizeof(*pf->msix_entries), GFP_KERNEL); in ice_ena_msix_range()
4061 if (!pf->msix_entries) { in ice_ena_msix_range()
4067 pf->msix_entries[i].entry = i; in ice_ena_msix_range()
4070 v_actual = pci_enable_msix_range(pf->pdev, pf->msix_entries, in ice_ena_msix_range()
4084 pci_disable_msix(pf->pdev); in ice_ena_msix_range()
4093 ice_reduce_msix_usage(pf, v_remain); in ice_ena_msix_range()
4096 pf->num_lan_msix); in ice_ena_msix_range()
4098 if (ice_is_rdma_ena(pf)) in ice_ena_msix_range()
4100 pf->num_rdma_msix); in ice_ena_msix_range()
4107 devm_kfree(dev, pf->msix_entries); in ice_ena_msix_range()
4110 pf->num_rdma_msix = 0; in ice_ena_msix_range()
4111 pf->num_lan_msix = 0; in ice_ena_msix_range()
4117 * @pf: board private structure
4119 static void ice_dis_msix(struct ice_pf *pf) in ice_dis_msix() argument
4121 pci_disable_msix(pf->pdev); in ice_dis_msix()
4122 devm_kfree(ice_pf_to_dev(pf), pf->msix_entries); in ice_dis_msix()
4123 pf->msix_entries = NULL; in ice_dis_msix()
4128 * @pf: board private structure
4130 static void ice_clear_interrupt_scheme(struct ice_pf *pf) in ice_clear_interrupt_scheme() argument
4132 ice_dis_msix(pf); in ice_clear_interrupt_scheme()
4134 if (pf->irq_tracker) { in ice_clear_interrupt_scheme()
4135 devm_kfree(ice_pf_to_dev(pf), pf->irq_tracker); in ice_clear_interrupt_scheme()
4136 pf->irq_tracker = NULL; in ice_clear_interrupt_scheme()
4142 * @pf: board private structure to initialize
4144 static int ice_init_interrupt_scheme(struct ice_pf *pf) in ice_init_interrupt_scheme() argument
4148 vectors = ice_ena_msix_range(pf); in ice_init_interrupt_scheme()
4154 pf->irq_tracker = devm_kzalloc(ice_pf_to_dev(pf), in ice_init_interrupt_scheme()
4155 struct_size(pf->irq_tracker, list, vectors), in ice_init_interrupt_scheme()
4157 if (!pf->irq_tracker) { in ice_init_interrupt_scheme()
4158 ice_dis_msix(pf); in ice_init_interrupt_scheme()
4163 pf->num_avail_sw_msix = (u16)vectors; in ice_init_interrupt_scheme()
4164 pf->irq_tracker->num_entries = (u16)vectors; in ice_init_interrupt_scheme()
4165 pf->irq_tracker->end = pf->irq_tracker->num_entries; in ice_init_interrupt_scheme()
4182 * word) indicates WoL is not supported on the corresponding PF ID. in ice_is_wol_supported()
4202 struct ice_pf *pf = vsi->back; in ice_vsi_recfg_qs() local
4208 while (test_and_set_bit(ICE_CFG_BUSY, pf->state)) { in ice_vsi_recfg_qs()
4223 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()
4229 ice_pf_dcb_recfg(pf); in ice_vsi_recfg_qs()
4232 clear_bit(ICE_CFG_BUSY, pf->state); in ice_vsi_recfg_qs()
4237 * ice_set_safe_mode_vlan_cfg - configure PF VSI to allow all VLANs in safe mode
4238 * @pf: PF to configure
4240 * No VLAN offloads/filtering are advertised in safe mode so make sure the PF
4243 static void ice_set_safe_mode_vlan_cfg(struct ice_pf *pf) in ice_set_safe_mode_vlan_cfg() argument
4245 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_set_safe_mode_vlan_cfg()
4257 hw = &pf->hw; in ice_set_safe_mode_vlan_cfg()
4296 struct ice_pf *pf = hw->back; in ice_log_pkg_init() local
4299 dev = ice_pf_to_dev(pf); in ice_log_pkg_init()
4373 * @pf: pointer to the PF instance
4379 ice_load_pkg(const struct firmware *firmware, struct ice_pf *pf) in ice_load_pkg() argument
4382 struct device *dev = ice_pf_to_dev(pf); in ice_load_pkg()
4383 struct ice_hw *hw = &pf->hw; in ice_load_pkg()
4400 clear_bit(ICE_FLAG_ADV_FEATURES, pf->flags); in ice_load_pkg()
4407 set_bit(ICE_FLAG_ADV_FEATURES, pf->flags); in ice_load_pkg()
4412 * @pf: pointer to the PF structure
4418 static void ice_verify_cacheline_size(struct ice_pf *pf) in ice_verify_cacheline_size() argument
4420 if (rd32(&pf->hw, GLPCI_CNF2) & GLPCI_CNF2_CACHELINE_SIZE_M) in ice_verify_cacheline_size()
4421 …dev_warn(ice_pf_to_dev(pf), "%d Byte cache line assumption is invalid, driver may have Tx timeouts… in ice_verify_cacheline_size()
4427 * @pf: PF struct
4431 static int ice_send_version(struct ice_pf *pf) in ice_send_version() argument
4441 return ice_aq_send_driver_ver(&pf->hw, &dv, NULL); in ice_send_version()
4446 * @pf: pointer to the PF instance
4450 static int ice_init_fdir(struct ice_pf *pf) in ice_init_fdir() argument
4452 struct device *dev = ice_pf_to_dev(pf); in ice_init_fdir()
4457 * Allocate it and store it in the PF. in ice_init_fdir()
4459 ctrl_vsi = ice_ctrl_vsi_setup(pf, pf->hw.port_info); in ice_init_fdir()
4471 mutex_init(&pf->hw.fdir_fltr_lock); in ice_init_fdir()
4473 err = ice_fdir_create_dflt_rules(pf); in ice_init_fdir()
4480 ice_fdir_release_flows(&pf->hw); in ice_init_fdir()
4484 if (pf->ctrl_vsi_idx != ICE_NO_VSI) { in ice_init_fdir()
4485 pf->vsi[pf->ctrl_vsi_idx] = NULL; in ice_init_fdir()
4486 pf->ctrl_vsi_idx = ICE_NO_VSI; in ice_init_fdir()
4493 * @pf: pointer to the PF instance
4495 static char *ice_get_opt_fw_name(struct ice_pf *pf) in ice_get_opt_fw_name() argument
4500 struct pci_dev *pdev = pf->pdev; in ice_get_opt_fw_name()
4523 * @pf: pointer to the PF instance
4525 static void ice_request_fw(struct ice_pf *pf) in ice_request_fw() argument
4527 char *opt_fw_filename = ice_get_opt_fw_name(pf); in ice_request_fw()
4529 struct device *dev = ice_pf_to_dev(pf); in ice_request_fw()
4544 ice_load_pkg(firmware, pf); in ice_request_fw()
4558 ice_load_pkg(firmware, pf); in ice_request_fw()
4564 * @pf: pointer to the PF struct
4566 static void ice_print_wake_reason(struct ice_pf *pf) in ice_print_wake_reason() argument
4568 u32 wus = pf->wakeup_reason; in ice_print_wake_reason()
4586 dev_info(ice_pf_to_dev(pf), "Wake reason: %s", wake_str); in ice_print_wake_reason()
4591 * @pf: pointer to the PF struct
4593 static int ice_register_netdev(struct ice_pf *pf) in ice_register_netdev() argument
4598 vsi = ice_get_main_vsi(pf); in ice_register_netdev()
4602 err = ice_devlink_create_pf_port(pf); in ice_register_netdev()
4614 devlink_port_type_eth_set(&pf->devlink_port, vsi->netdev); in ice_register_netdev()
4618 ice_devlink_destroy_pf_port(pf); in ice_register_netdev()
4637 struct ice_pf *pf; in ice_probe() local
4659 pf = ice_allocate_pf(dev); in ice_probe()
4660 if (!pf) in ice_probe()
4664 pf->aux_idx = -1; in ice_probe()
4676 pf->pdev = pdev; in ice_probe()
4677 pci_set_drvdata(pdev, pf); in ice_probe()
4678 set_bit(ICE_DOWN, pf->state); in ice_probe()
4680 set_bit(ICE_SERVICE_DIS, pf->state); in ice_probe()
4682 hw = &pf->hw; in ice_probe()
4686 hw->back = pf; in ice_probe()
4696 pf->msg_enable = netif_msg_init(debug, ICE_DFLT_NETIF_M); in ice_probe()
4710 ice_init_feature_support(pf); in ice_probe()
4712 ice_request_fw(pf); in ice_probe()
4715 * set in pf->state, which will cause ice_is_safe_mode to return in ice_probe()
4718 if (ice_is_safe_mode(pf)) { in ice_probe()
4727 err = ice_init_pf(pf); in ice_probe()
4733 ice_devlink_init_regions(pf); in ice_probe()
4735 pf->hw.udp_tunnel_nic.set_port = ice_udp_tunnel_set_port; in ice_probe()
4736 pf->hw.udp_tunnel_nic.unset_port = ice_udp_tunnel_unset_port; in ice_probe()
4737 pf->hw.udp_tunnel_nic.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP; in ice_probe()
4738 pf->hw.udp_tunnel_nic.shared = &pf->hw.udp_tunnel_shared; in ice_probe()
4740 if (pf->hw.tnl.valid_count[TNL_VXLAN]) { in ice_probe()
4741 pf->hw.udp_tunnel_nic.tables[i].n_entries = in ice_probe()
4742 pf->hw.tnl.valid_count[TNL_VXLAN]; in ice_probe()
4743 pf->hw.udp_tunnel_nic.tables[i].tunnel_types = in ice_probe()
4747 if (pf->hw.tnl.valid_count[TNL_GENEVE]) { in ice_probe()
4748 pf->hw.udp_tunnel_nic.tables[i].n_entries = in ice_probe()
4749 pf->hw.tnl.valid_count[TNL_GENEVE]; in ice_probe()
4750 pf->hw.udp_tunnel_nic.tables[i].tunnel_types = in ice_probe()
4755 pf->num_alloc_vsi = hw->func_caps.guar_num_vsi; in ice_probe()
4756 if (!pf->num_alloc_vsi) { in ice_probe()
4760 if (pf->num_alloc_vsi > UDP_TUNNEL_NIC_MAX_SHARING_DEVICES) { in ice_probe()
4761 dev_warn(&pf->pdev->dev, in ice_probe()
4763 pf->num_alloc_vsi, UDP_TUNNEL_NIC_MAX_SHARING_DEVICES); in ice_probe()
4764 pf->num_alloc_vsi = UDP_TUNNEL_NIC_MAX_SHARING_DEVICES; in ice_probe()
4767 pf->vsi = devm_kcalloc(dev, pf->num_alloc_vsi, sizeof(*pf->vsi), in ice_probe()
4769 if (!pf->vsi) { in ice_probe()
4774 err = ice_init_interrupt_scheme(pf); in ice_probe()
4786 err = ice_req_irq_msix_misc(pf); in ice_probe()
4793 pf->first_sw = devm_kzalloc(dev, sizeof(*pf->first_sw), GFP_KERNEL); in ice_probe()
4794 if (!pf->first_sw) { in ice_probe()
4800 pf->first_sw->bridge_mode = BRIDGE_MODE_VEB; in ice_probe()
4802 pf->first_sw->bridge_mode = BRIDGE_MODE_VEPA; in ice_probe()
4804 pf->first_sw->pf = pf; in ice_probe()
4807 pf->first_sw->sw_id = hw->port_info->sw_id; in ice_probe()
4809 err = ice_setup_pf_sw(pf); in ice_probe()
4811 dev_err(dev, "probe failed due to setup PF switch: %d\n", err); in ice_probe()
4815 clear_bit(ICE_SERVICE_DIS, pf->state); in ice_probe()
4818 err = ice_send_version(pf); in ice_probe()
4826 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); in ice_probe()
4828 err = ice_init_link_events(pf->hw.port_info); in ice_probe()
4835 err = ice_init_nvm_phy_type(pf->hw.port_info); in ice_probe()
4840 err = ice_update_link_info(pf->hw.port_info); in ice_probe()
4844 ice_init_link_dflt_override(pf->hw.port_info); in ice_probe()
4846 ice_check_link_cfg_err(pf, in ice_probe()
4847 pf->hw.port_info->phy.link_info.link_cfg_err); in ice_probe()
4850 if (pf->hw.port_info->phy.link_info.link_info & in ice_probe()
4853 err = ice_init_phy_user_cfg(pf->hw.port_info); in ice_probe()
4857 if (!test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags)) { in ice_probe()
4858 struct ice_vsi *vsi = ice_get_main_vsi(pf); in ice_probe()
4864 set_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_probe()
4867 ice_verify_cacheline_size(pf); in ice_probe()
4870 pf->wakeup_reason = rd32(hw, PFPM_WUS); in ice_probe()
4873 ice_print_wake_reason(pf); in ice_probe()
4881 if (ice_is_safe_mode(pf)) { in ice_probe()
4882 ice_set_safe_mode_vlan_cfg(pf); in ice_probe()
4887 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) in ice_probe()
4888 ice_ptp_init(pf); in ice_probe()
4890 if (ice_is_feature_supported(pf, ICE_F_GNSS)) in ice_probe()
4891 ice_gnss_init(pf); in ice_probe()
4894 if (ice_init_fdir(pf)) in ice_probe()
4898 if (ice_init_pf_dcb(pf, false)) { in ice_probe()
4899 clear_bit(ICE_FLAG_DCB_CAPABLE, pf->flags); in ice_probe()
4900 clear_bit(ICE_FLAG_DCB_ENA, pf->flags); in ice_probe()
4902 ice_cfg_lldp_mib_change(&pf->hw, true); in ice_probe()
4905 if (ice_init_lag(pf)) in ice_probe()
4909 pcie_print_link_status(pf->pdev); in ice_probe()
4912 err = ice_register_netdev(pf); in ice_probe()
4916 err = ice_devlink_register_params(pf); in ice_probe()
4921 clear_bit(ICE_DOWN, pf->state); in ice_probe()
4922 if (ice_is_rdma_ena(pf)) { in ice_probe()
4923 pf->aux_idx = ida_alloc(&ice_aux_ida, GFP_KERNEL); in ice_probe()
4924 if (pf->aux_idx < 0) { in ice_probe()
4930 err = ice_init_rdma(pf); in ice_probe()
4940 ice_devlink_register(pf); in ice_probe()
4944 pf->adev = NULL; in ice_probe()
4945 ida_free(&ice_aux_ida, pf->aux_idx); in ice_probe()
4947 ice_devlink_unregister_params(pf); in ice_probe()
4950 ice_vsi_release_all(pf); in ice_probe()
4952 set_bit(ICE_SERVICE_DIS, pf->state); in ice_probe()
4953 set_bit(ICE_DOWN, pf->state); in ice_probe()
4954 devm_kfree(dev, pf->first_sw); in ice_probe()
4956 ice_free_irq_msix_misc(pf); in ice_probe()
4958 ice_clear_interrupt_scheme(pf); in ice_probe()
4960 devm_kfree(dev, pf->vsi); in ice_probe()
4962 ice_deinit_pf(pf); in ice_probe()
4963 ice_devlink_destroy_regions(pf); in ice_probe()
4973 * @pf: pointer to the PF struct
4977 static void ice_set_wake(struct ice_pf *pf) in ice_set_wake() argument
4979 struct ice_hw *hw = &pf->hw; in ice_set_wake()
4980 bool wol = pf->wol_ena; in ice_set_wake()
4994 * @pf: pointer to the PF struct
4998 * wake, and that PF reset doesn't undo the LAA.
5000 static void ice_setup_mc_magic_wake(struct ice_pf *pf) in ice_setup_mc_magic_wake() argument
5002 struct device *dev = ice_pf_to_dev(pf); in ice_setup_mc_magic_wake()
5003 struct ice_hw *hw = &pf->hw; in ice_setup_mc_magic_wake()
5009 if (!pf->wol_ena) in ice_setup_mc_magic_wake()
5012 vsi = ice_get_main_vsi(pf); in ice_setup_mc_magic_wake()
5038 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_remove() local
5041 ice_devlink_unregister(pf); in ice_remove()
5043 if (!ice_is_reset_in_progress(pf->state)) in ice_remove()
5048 ice_tc_indir_block_remove(pf); in ice_remove()
5050 if (test_bit(ICE_FLAG_SRIOV_ENA, pf->flags)) { in ice_remove()
5051 set_bit(ICE_VF_RESETS_DISABLED, pf->state); in ice_remove()
5052 ice_free_vfs(pf); in ice_remove()
5055 ice_service_task_stop(pf); in ice_remove()
5057 ice_aq_cancel_waiting_tasks(pf); in ice_remove()
5058 ice_unplug_aux_dev(pf); in ice_remove()
5059 if (pf->aux_idx >= 0) in ice_remove()
5060 ida_free(&ice_aux_ida, pf->aux_idx); in ice_remove()
5061 ice_devlink_unregister_params(pf); in ice_remove()
5062 set_bit(ICE_DOWN, pf->state); in ice_remove()
5064 ice_deinit_lag(pf); in ice_remove()
5065 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) in ice_remove()
5066 ice_ptp_release(pf); in ice_remove()
5067 if (ice_is_feature_supported(pf, ICE_F_GNSS)) in ice_remove()
5068 ice_gnss_exit(pf); in ice_remove()
5069 if (!ice_is_safe_mode(pf)) in ice_remove()
5070 ice_remove_arfs(pf); in ice_remove()
5071 ice_setup_mc_magic_wake(pf); in ice_remove()
5072 ice_vsi_release_all(pf); in ice_remove()
5073 mutex_destroy(&(&pf->hw)->fdir_fltr_lock); in ice_remove()
5074 ice_set_wake(pf); in ice_remove()
5075 ice_free_irq_msix_misc(pf); in ice_remove()
5076 ice_for_each_vsi(pf, i) { in ice_remove()
5077 if (!pf->vsi[i]) in ice_remove()
5079 ice_vsi_free_q_vectors(pf->vsi[i]); in ice_remove()
5081 ice_deinit_pf(pf); in ice_remove()
5082 ice_devlink_destroy_regions(pf); in ice_remove()
5083 ice_deinit_hw(&pf->hw); in ice_remove()
5089 ice_reset(&pf->hw, ICE_RESET_PFR); in ice_remove()
5091 ice_clear_interrupt_scheme(pf); in ice_remove()
5102 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_shutdown() local
5107 pci_wake_from_d3(pdev, pf->wol_ena); in ice_shutdown()
5115 * @pf: board private structure
5119 static void ice_prepare_for_shutdown(struct ice_pf *pf) in ice_prepare_for_shutdown() argument
5121 struct ice_hw *hw = &pf->hw; in ice_prepare_for_shutdown()
5126 ice_vc_notify_reset(pf); in ice_prepare_for_shutdown()
5128 dev_dbg(ice_pf_to_dev(pf), "Tearing down internal switch for shutdown\n"); in ice_prepare_for_shutdown()
5131 ice_pf_dis_all_vsi(pf, false); in ice_prepare_for_shutdown()
5133 ice_for_each_vsi(pf, v) in ice_prepare_for_shutdown()
5134 if (pf->vsi[v]) in ice_prepare_for_shutdown()
5135 pf->vsi[v]->vsi_num = 0; in ice_prepare_for_shutdown()
5142 * @pf: board private structure to reinitialize
5150 static int ice_reinit_interrupt_scheme(struct ice_pf *pf) in ice_reinit_interrupt_scheme() argument
5152 struct device *dev = ice_pf_to_dev(pf); in ice_reinit_interrupt_scheme()
5159 ret = ice_init_interrupt_scheme(pf); in ice_reinit_interrupt_scheme()
5166 ice_for_each_vsi(pf, v) { in ice_reinit_interrupt_scheme()
5167 if (!pf->vsi[v]) in ice_reinit_interrupt_scheme()
5170 ret = ice_vsi_alloc_q_vectors(pf->vsi[v]); in ice_reinit_interrupt_scheme()
5173 ice_vsi_map_rings_to_vectors(pf->vsi[v]); in ice_reinit_interrupt_scheme()
5176 ret = ice_req_irq_msix_misc(pf); in ice_reinit_interrupt_scheme()
5187 if (pf->vsi[v]) in ice_reinit_interrupt_scheme()
5188 ice_vsi_free_q_vectors(pf->vsi[v]); in ice_reinit_interrupt_scheme()
5203 struct ice_pf *pf; in ice_suspend() local
5206 pf = pci_get_drvdata(pdev); in ice_suspend()
5208 if (!ice_pf_state_is_nominal(pf)) { in ice_suspend()
5219 disabled = ice_service_task_stop(pf); in ice_suspend()
5221 ice_unplug_aux_dev(pf); in ice_suspend()
5224 if (test_and_set_bit(ICE_SUSPENDED, pf->state)) { in ice_suspend()
5226 ice_service_task_restart(pf); in ice_suspend()
5230 if (test_bit(ICE_DOWN, pf->state) || in ice_suspend()
5231 ice_is_reset_in_progress(pf->state)) { in ice_suspend()
5234 ice_service_task_restart(pf); in ice_suspend()
5238 ice_setup_mc_magic_wake(pf); in ice_suspend()
5240 ice_prepare_for_shutdown(pf); in ice_suspend()
5242 ice_set_wake(pf); in ice_suspend()
5249 ice_free_irq_msix_misc(pf); in ice_suspend()
5250 ice_for_each_vsi(pf, v) { in ice_suspend()
5251 if (!pf->vsi[v]) in ice_suspend()
5253 ice_vsi_free_q_vectors(pf->vsi[v]); in ice_suspend()
5255 ice_clear_interrupt_scheme(pf); in ice_suspend()
5258 pci_wake_from_d3(pdev, pf->wol_ena); in ice_suspend()
5271 struct ice_pf *pf; in ice_resume() local
5288 pf = pci_get_drvdata(pdev); in ice_resume()
5289 hw = &pf->hw; in ice_resume()
5291 pf->wakeup_reason = rd32(hw, PFPM_WUS); in ice_resume()
5292 ice_print_wake_reason(pf); in ice_resume()
5297 ret = ice_reinit_interrupt_scheme(pf); in ice_resume()
5301 clear_bit(ICE_DOWN, pf->state); in ice_resume()
5302 /* Now perform PF reset and rebuild */ in ice_resume()
5305 clear_bit(ICE_SERVICE_DIS, pf->state); in ice_resume()
5307 if (ice_schedule_reset(pf, reset_type)) in ice_resume()
5310 clear_bit(ICE_SUSPENDED, pf->state); in ice_resume()
5311 ice_service_task_restart(pf); in ice_resume()
5314 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); in ice_resume()
5331 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_detected() local
5333 if (!pf) { in ice_pci_err_detected()
5339 if (!test_bit(ICE_SUSPENDED, pf->state)) { in ice_pci_err_detected()
5340 ice_service_task_stop(pf); in ice_pci_err_detected()
5342 if (!test_bit(ICE_PREPARED_FOR_RESET, pf->state)) { in ice_pci_err_detected()
5343 set_bit(ICE_PFR_REQ, pf->state); in ice_pci_err_detected()
5344 ice_prepare_for_reset(pf, ICE_RESET_PFR); in ice_pci_err_detected()
5360 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_slot_reset() local
5377 reg = rd32(&pf->hw, GLGEN_RTRIG); in ice_pci_err_slot_reset()
5396 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_resume() local
5398 if (!pf) { in ice_pci_err_resume()
5404 if (test_bit(ICE_SUSPENDED, pf->state)) { in ice_pci_err_resume()
5412 ice_do_reset(pf, ICE_RESET_PFR); in ice_pci_err_resume()
5413 ice_service_task_restart(pf); in ice_pci_err_resume()
5414 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); in ice_pci_err_resume()
5423 struct ice_pf *pf = pci_get_drvdata(pdev); in ice_pci_err_reset_prepare() local
5425 if (!test_bit(ICE_SUSPENDED, pf->state)) { in ice_pci_err_reset_prepare()
5426 ice_service_task_stop(pf); in ice_pci_err_reset_prepare()
5428 if (!test_bit(ICE_PREPARED_FOR_RESET, pf->state)) { in ice_pci_err_reset_prepare()
5429 set_bit(ICE_PFR_REQ, pf->state); in ice_pci_err_reset_prepare()
5430 ice_prepare_for_reset(pf, ICE_RESET_PFR); in ice_pci_err_reset_prepare()
5561 struct ice_pf *pf = vsi->back; in ice_set_mac_address() local
5562 struct ice_hw *hw = &pf->hw; in ice_set_mac_address()
5579 if (test_bit(ICE_DOWN, pf->state) || in ice_set_mac_address()
5580 ice_is_reset_in_progress(pf->state)) { in ice_set_mac_address()
5586 if (ice_chnl_dmac_fltr_cnt(pf)) { in ice_set_mac_address()
5886 * ice_set_vlan_offload_features - set VLAN offload features for the PF VSI
5887 * @vsi: PF's VSI
5931 * ice_set_vlan_filtering_features - set VLAN filtering features for the PF VSI
5932 * @vsi: PF's VSI
6000 * ice_set_loopback - turn on/off loopback mode on underlying PF
6036 struct ice_pf *pf = vsi->back; in ice_set_features() local
6040 if (ice_is_safe_mode(pf)) { in ice_set_features()
6041 dev_err(ice_pf_to_dev(pf), in ice_set_features()
6047 if (ice_is_reset_in_progress(pf->state)) { in ice_set_features()
6048 dev_err(ice_pf_to_dev(pf), in ice_set_features()
6088 if (!(features & NETIF_F_HW_TC) && ice_is_adq_active(pf)) { in ice_set_features()
6089 dev_err(ice_pf_to_dev(pf), "ADQ is active, can't turn hw_tc_offload off\n"); in ice_set_features()
6096 ena ? set_bit(ICE_FLAG_CLS_FLOWER, pf->flags) : in ice_set_features()
6097 clear_bit(ICE_FLAG_CLS_FLOWER, pf->flags); in ice_set_features()
6107 * ice_vsi_vlan_setup - Setup VLAN offload properties on a PF VSI
6305 struct ice_pf *pf = vsi->back; in ice_up_complete() local
6328 if (!ice_is_e810(&pf->hw)) in ice_up_complete()
6329 ice_ptp_link_change(pf, pf->hw.pf_id, true); in ice_up_complete()
6336 ice_service_task_schedule(pf); in ice_up_complete()
6470 struct ice_pf *pf = vsi->back; in ice_update_vsi_stats() local
6473 test_bit(ICE_CFG_BUSY, pf->state)) in ice_update_vsi_stats()
6489 cur_ns->rx_crc_errors = pf->stats.crc_errors; in ice_update_vsi_stats()
6490 cur_ns->rx_errors = pf->stats.crc_errors + in ice_update_vsi_stats()
6491 pf->stats.illegal_bytes + in ice_update_vsi_stats()
6492 pf->stats.rx_len_errors + in ice_update_vsi_stats()
6493 pf->stats.rx_undersize + in ice_update_vsi_stats()
6494 pf->hw_csum_rx_error + in ice_update_vsi_stats()
6495 pf->stats.rx_jabber + in ice_update_vsi_stats()
6496 pf->stats.rx_fragments + in ice_update_vsi_stats()
6497 pf->stats.rx_oversize; in ice_update_vsi_stats()
6498 cur_ns->rx_length_errors = pf->stats.rx_len_errors; in ice_update_vsi_stats()
6500 cur_ns->rx_missed_errors = pf->stats.eth.rx_discards; in ice_update_vsi_stats()
6505 * ice_update_pf_stats - Update PF port stats counters
6506 * @pf: PF whose stats needs to be updated
6508 void ice_update_pf_stats(struct ice_pf *pf) in ice_update_pf_stats() argument
6511 struct ice_hw *hw = &pf->hw; in ice_update_pf_stats()
6516 prev_ps = &pf->stats_prev; in ice_update_pf_stats()
6517 cur_ps = &pf->stats; in ice_update_pf_stats()
6519 ice_stat_update40(hw, GLPRT_GORCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6523 ice_stat_update40(hw, GLPRT_UPRCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6527 ice_stat_update40(hw, GLPRT_MPRCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6531 ice_stat_update40(hw, GLPRT_BPRCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6535 ice_stat_update32(hw, PRTRPB_RDPC, pf->stat_prev_loaded, in ice_update_pf_stats()
6539 ice_stat_update40(hw, GLPRT_GOTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6543 ice_stat_update40(hw, GLPRT_UPTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6547 ice_stat_update40(hw, GLPRT_MPTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6551 ice_stat_update40(hw, GLPRT_BPTCL(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6555 ice_stat_update32(hw, GLPRT_TDOLD(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6559 ice_stat_update40(hw, GLPRT_PRC64L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6562 ice_stat_update40(hw, GLPRT_PRC127L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6565 ice_stat_update40(hw, GLPRT_PRC255L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6568 ice_stat_update40(hw, GLPRT_PRC511L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6571 ice_stat_update40(hw, GLPRT_PRC1023L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6574 ice_stat_update40(hw, GLPRT_PRC1522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6577 ice_stat_update40(hw, GLPRT_PRC9522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6580 ice_stat_update40(hw, GLPRT_PTC64L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6583 ice_stat_update40(hw, GLPRT_PTC127L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6586 ice_stat_update40(hw, GLPRT_PTC255L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6589 ice_stat_update40(hw, GLPRT_PTC511L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6592 ice_stat_update40(hw, GLPRT_PTC1023L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6595 ice_stat_update40(hw, GLPRT_PTC1522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6598 ice_stat_update40(hw, GLPRT_PTC9522L(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6605 pf->stat_prev_loaded, &prev_ps->fd_sb_match, in ice_update_pf_stats()
6607 ice_stat_update32(hw, GLPRT_LXONRXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6610 ice_stat_update32(hw, GLPRT_LXOFFRXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6613 ice_stat_update32(hw, GLPRT_LXONTXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6616 ice_stat_update32(hw, GLPRT_LXOFFTXC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6619 ice_update_dcb_stats(pf); in ice_update_pf_stats()
6621 ice_stat_update32(hw, GLPRT_CRCERRS(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6624 ice_stat_update32(hw, GLPRT_ILLERRC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6627 ice_stat_update32(hw, GLPRT_MLFC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6631 ice_stat_update32(hw, GLPRT_MRFC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6635 ice_stat_update32(hw, GLPRT_RLEC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6638 ice_stat_update32(hw, GLPRT_RUC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6641 ice_stat_update32(hw, GLPRT_RFC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6644 ice_stat_update32(hw, GLPRT_ROC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6647 ice_stat_update32(hw, GLPRT_RJC(port), pf->stat_prev_loaded, in ice_update_pf_stats()
6650 cur_ps->fd_sb_status = test_bit(ICE_FLAG_FD_ENA, pf->flags) ? 1 : 0; in ice_update_pf_stats()
6652 pf->stat_prev_loaded = true; in ice_update_pf_stats()
6876 struct ice_pf *pf = vsi->back; in ice_vsi_open_ctrl() local
6880 dev = ice_pf_to_dev(pf); in ice_vsi_open_ctrl()
6932 struct ice_pf *pf = vsi->back; in ice_vsi_open() local
6949 dev_driver_string(ice_pf_to_dev(pf)), vsi->netdev->name); in ice_vsi_open()
6987 * @pf: PF from which all VSIs are being removed
6989 static void ice_vsi_release_all(struct ice_pf *pf) in ice_vsi_release_all() argument
6993 if (!pf->vsi) in ice_vsi_release_all()
6996 ice_for_each_vsi(pf, i) { in ice_vsi_release_all()
6997 if (!pf->vsi[i]) in ice_vsi_release_all()
7000 if (pf->vsi[i]->type == ICE_VSI_CHNL) in ice_vsi_release_all()
7003 err = ice_vsi_release(pf->vsi[i]); in ice_vsi_release_all()
7005 dev_dbg(ice_pf_to_dev(pf), "Failed to release pf->vsi[%d], err %d, vsi_num = %d\n", in ice_vsi_release_all()
7006 i, err, pf->vsi[i]->vsi_num); in ice_vsi_release_all()
7012 * @pf: pointer to the PF instance
7015 * Iterates through the pf->vsi array and rebuilds VSIs of the requested type
7017 static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type) in ice_vsi_rebuild_by_type() argument
7019 struct device *dev = ice_pf_to_dev(pf); in ice_vsi_rebuild_by_type()
7022 ice_for_each_vsi(pf, i) { in ice_vsi_rebuild_by_type()
7023 struct ice_vsi *vsi = pf->vsi[i]; in ice_vsi_rebuild_by_type()
7037 err = ice_replay_vsi(&pf->hw, vsi->idx); in ice_vsi_rebuild_by_type()
7047 vsi->vsi_num = ice_get_hw_vsi_num(&pf->hw, vsi->idx); in ice_vsi_rebuild_by_type()
7065 * ice_update_pf_netdev_link - Update PF netdev link status
7066 * @pf: pointer to the PF instance
7068 static void ice_update_pf_netdev_link(struct ice_pf *pf) in ice_update_pf_netdev_link() argument
7073 ice_for_each_vsi(pf, i) { in ice_update_pf_netdev_link()
7074 struct ice_vsi *vsi = pf->vsi[i]; in ice_update_pf_netdev_link()
7079 ice_get_link_status(pf->vsi[i]->port_info, &link_up); in ice_update_pf_netdev_link()
7081 netif_carrier_on(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
7082 netif_tx_wake_all_queues(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
7084 netif_carrier_off(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
7085 netif_tx_stop_all_queues(pf->vsi[i]->netdev); in ice_update_pf_netdev_link()
7092 * @pf: PF to rebuild
7100 static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) in ice_rebuild() argument
7102 struct device *dev = ice_pf_to_dev(pf); in ice_rebuild()
7103 struct ice_hw *hw = &pf->hw; in ice_rebuild()
7107 if (test_bit(ICE_DOWN, pf->state)) in ice_rebuild()
7110 dev_dbg(dev, "rebuilding PF after reset_type=%d\n", reset_type); in ice_rebuild()
7118 pf->fw_emp_reset_disabled = false; in ice_rebuild()
7130 if (!ice_is_safe_mode(pf)) { in ice_rebuild()
7136 ice_load_pkg(NULL, pf); in ice_rebuild()
7141 dev_err(dev, "clear PF configuration failed %d\n", err); in ice_rebuild()
7167 err = ice_aq_set_port_params(pf->hw.port_info, dvm, NULL); in ice_rebuild()
7176 err = ice_req_irq_msix_misc(pf); in ice_rebuild()
7182 if (test_bit(ICE_FLAG_FD_ENA, pf->flags)) { in ice_rebuild()
7190 /* force guaranteed filter pool for PF */ in ice_rebuild()
7192 /* force shared filter pool for PF */ in ice_rebuild()
7197 if (test_bit(ICE_FLAG_DCB_ENA, pf->flags)) in ice_rebuild()
7198 ice_dcb_rebuild(pf); in ice_rebuild()
7200 /* If the PF previously had enabled PTP, PTP init needs to happen before in ice_rebuild()
7204 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) in ice_rebuild()
7205 ice_ptp_reset(pf); in ice_rebuild()
7207 if (ice_is_feature_supported(pf, ICE_F_GNSS)) in ice_rebuild()
7208 ice_gnss_init(pf); in ice_rebuild()
7210 /* rebuild PF VSI */ in ice_rebuild()
7211 err = ice_vsi_rebuild_by_type(pf, ICE_VSI_PF); in ice_rebuild()
7213 dev_err(dev, "PF VSI rebuild failed: %d\n", err); in ice_rebuild()
7218 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) in ice_rebuild()
7219 ice_ptp_cfg_timestamp(pf, false); in ice_rebuild()
7221 err = ice_vsi_rebuild_by_type(pf, ICE_VSI_SWITCHDEV_CTRL); in ice_rebuild()
7228 err = ice_rebuild_channels(pf); in ice_rebuild()
7237 if (test_bit(ICE_FLAG_FD_ENA, pf->flags)) { in ice_rebuild()
7238 err = ice_vsi_rebuild_by_type(pf, ICE_VSI_CTRL); in ice_rebuild()
7249 ice_fdir_replay_fltrs(pf); in ice_rebuild()
7251 ice_rebuild_arfs(pf); in ice_rebuild()
7254 ice_update_pf_netdev_link(pf); in ice_rebuild()
7257 err = ice_send_version(pf); in ice_rebuild()
7267 clear_bit(ICE_RESET_FAILED, pf->state); in ice_rebuild()
7269 ice_plug_aux_dev(pf); in ice_rebuild()
7277 set_bit(ICE_RESET_FAILED, pf->state); in ice_rebuild()
7279 /* set this bit in PF state to control service task scheduling */ in ice_rebuild()
7280 set_bit(ICE_NEEDS_RESTART, pf->state); in ice_rebuild()
7307 struct ice_pf *pf = vsi->back; in ice_change_mtu() local
7328 if (ice_is_reset_in_progress(pf->state)) { in ice_change_mtu()
7360 set_bit(ICE_FLAG_MTU_CHANGED, pf->flags); in ice_change_mtu()
7374 struct ice_pf *pf = np->vsi->back; in ice_eth_ioctl() local
7378 return ice_ptp_get_ts_config(pf, ifr); in ice_eth_ioctl()
7380 return ice_ptp_set_ts_config(pf, ifr); in ice_eth_ioctl()
7551 struct ice_pf *pf = vsi->back; in ice_bridge_getlink() local
7554 bmode = pf->first_sw->bridge_mode; in ice_bridge_getlink()
7612 * hooked up to. Iterates through the PF VSI list and sets the loopback mode (if
7622 struct ice_pf *pf = np->vsi->back; in ice_bridge_setlink() local
7624 struct ice_hw *hw = &pf->hw; in ice_bridge_setlink()
7628 pf_sw = pf->first_sw; in ice_bridge_setlink()
7643 /* Iterates through the PF VSI list and update the loopback in ice_bridge_setlink()
7646 ice_for_each_vsi(pf, v) { in ice_bridge_setlink()
7647 if (!pf->vsi[v]) in ice_bridge_setlink()
7649 err = ice_vsi_update_bridge_mode(pf->vsi[v], mode); in ice_bridge_setlink()
7684 struct ice_pf *pf = vsi->back; in ice_tx_timeout() local
7687 pf->tx_timeout_count++; in ice_tx_timeout()
7693 if (ice_is_pfc_causing_hung_q(pf, txqueue)) { in ice_tx_timeout()
7694 dev_info(ice_pf_to_dev(pf), "Fake Tx hang detected on queue %u, timeout caused by PFC storm\n", in ice_tx_timeout()
7710 if (time_after(jiffies, (pf->tx_timeout_last_recovery + HZ * 20))) in ice_tx_timeout()
7711 pf->tx_timeout_recovery_level = 1; in ice_tx_timeout()
7712 else if (time_before(jiffies, (pf->tx_timeout_last_recovery + in ice_tx_timeout()
7717 struct ice_hw *hw = &pf->hw; in ice_tx_timeout()
7730 pf->tx_timeout_last_recovery = jiffies; in ice_tx_timeout()
7732 pf->tx_timeout_recovery_level, txqueue); in ice_tx_timeout()
7734 switch (pf->tx_timeout_recovery_level) { in ice_tx_timeout()
7736 set_bit(ICE_PFR_REQ, pf->state); in ice_tx_timeout()
7739 set_bit(ICE_CORER_REQ, pf->state); in ice_tx_timeout()
7742 set_bit(ICE_GLOBR_REQ, pf->state); in ice_tx_timeout()
7746 set_bit(ICE_DOWN, pf->state); in ice_tx_timeout()
7748 set_bit(ICE_SERVICE_DIS, pf->state); in ice_tx_timeout()
7752 ice_service_task_schedule(pf); in ice_tx_timeout()
7753 pf->tx_timeout_recovery_level++; in ice_tx_timeout()
7817 struct ice_pf *pf = vsi->back; in ice_validate_mqprio_qopt() local
7831 dev = ice_pf_to_dev(pf); in ice_validate_mqprio_qopt()
7943 * ice_add_vsi_to_fdir - add a VSI to the flow director group for PF
7944 * @pf: ptr to PF device
7947 static int ice_add_vsi_to_fdir(struct ice_pf *pf, struct ice_vsi *vsi) in ice_add_vsi_to_fdir() argument
7949 struct device *dev = ice_pf_to_dev(pf); in ice_add_vsi_to_fdir()
7957 hw = &pf->hw; in ice_add_vsi_to_fdir()
8005 * @pf: ptr to PF device
8011 static int ice_add_channel(struct ice_pf *pf, u16 sw_id, struct ice_channel *ch) in ice_add_channel() argument
8013 struct device *dev = ice_pf_to_dev(pf); in ice_add_channel()
8021 vsi = ice_chnl_vsi_setup(pf, pf->hw.port_info, ch); in ice_add_channel()
8027 ice_add_vsi_to_fdir(pf, vsi); in ice_add_channel()
8119 * @pf: ptr to PF device
8129 ice_setup_hw_channel(struct ice_pf *pf, struct ice_vsi *vsi, in ice_setup_hw_channel() argument
8132 struct device *dev = ice_pf_to_dev(pf); in ice_setup_hw_channel()
8138 ret = ice_add_channel(pf, sw_id, ch); in ice_setup_hw_channel()
8159 * @pf: ptr to PF device
8167 ice_setup_channel(struct ice_pf *pf, struct ice_vsi *vsi, in ice_setup_channel() argument
8170 struct device *dev = ice_pf_to_dev(pf); in ice_setup_channel()
8179 sw_id = pf->first_sw->sw_id; in ice_setup_channel()
8182 ret = ice_setup_hw_channel(pf, vsi, ch, sw_id, ICE_VSI_CHNL); in ice_setup_channel()
8220 struct ice_pf *pf = vsi->back; in ice_create_q_channel() local
8226 dev = ice_pf_to_dev(pf); in ice_create_q_channel()
8238 if (!ice_setup_channel(pf, vsi, ch)) { in ice_create_q_channel()
8263 * @pf: ptr to PF, TC-flower based filter are tracked at PF level
8268 static void ice_rem_all_chnl_fltrs(struct ice_pf *pf) in ice_rem_all_chnl_fltrs() argument
8275 &pf->tc_flower_fltr_list, in ice_rem_all_chnl_fltrs()
8287 status = ice_rem_adv_rule_by_id(&pf->hw, &rule); in ice_rem_all_chnl_fltrs()
8290 dev_dbg(ice_pf_to_dev(pf), "TC flower filter (rule_id %u) does not exist\n", in ice_rem_all_chnl_fltrs()
8293 dev_err(ice_pf_to_dev(pf), "failed to delete TC flower filter, status %d\n", in ice_rem_all_chnl_fltrs()
8303 pf->num_dmac_chnl_fltrs--; in ice_rem_all_chnl_fltrs()
8322 struct ice_pf *pf = vsi->back; in ice_remove_q_channels() local
8327 ice_rem_all_chnl_fltrs(pf); in ice_remove_q_channels()
8331 struct ice_hw *hw = &pf->hw; in ice_remove_q_channels()
8369 ice_fdir_rem_adq_chnl(&pf->hw, ch->ch_vsi->idx); in ice_remove_q_channels()
8377 /* Delete VSI from PF and HW VSI arrays */ in ice_remove_q_channels()
8395 * @pf: ptr to PF
8399 static int ice_rebuild_channels(struct ice_pf *pf) in ice_rebuild_channels() argument
8401 struct device *dev = ice_pf_to_dev(pf); in ice_rebuild_channels()
8409 main_vsi = ice_get_main_vsi(pf); in ice_rebuild_channels()
8413 if (!test_bit(ICE_FLAG_TC_MQPRIO, pf->flags) || in ice_rebuild_channels()
8428 ice_for_each_vsi(pf, i) { in ice_rebuild_channels()
8431 vsi = pf->vsi[i]; in ice_rebuild_channels()
8448 vsi->vsi_num = ice_get_hw_vsi_num(&pf->hw, vsi->idx); in ice_rebuild_channels()
8451 err = ice_replay_vsi(&pf->hw, vsi->idx); in ice_rebuild_channels()
8515 struct ice_pf *pf = vsi->back; in ice_create_q_channels() local
8545 dev_err(ice_pf_to_dev(pf), in ice_create_q_channels()
8552 dev_dbg(ice_pf_to_dev(pf), in ice_create_q_channels()
8573 struct ice_pf *pf = vsi->back; in ice_setup_tc_mqprio_qdisc() local
8580 dev = ice_pf_to_dev(pf); in ice_setup_tc_mqprio_qdisc()
8585 clear_bit(ICE_FLAG_TC_MQPRIO, pf->flags); in ice_setup_tc_mqprio_qdisc()
8605 set_bit(ICE_FLAG_TC_MQPRIO, pf->flags); in ice_setup_tc_mqprio_qdisc()
8611 set_bit(ICE_FLAG_CLS_FLOWER, pf->flags); in ice_setup_tc_mqprio_qdisc()
8627 if (!hw && !test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) in ice_setup_tc_mqprio_qdisc()
8630 if (!hw && !test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) { in ice_setup_tc_mqprio_qdisc()
8631 vsi->req_txq = min_t(int, ice_get_avail_txq_count(pf), in ice_setup_tc_mqprio_qdisc()
8633 vsi->req_rxq = min_t(int, ice_get_avail_rxq_count(pf), in ice_setup_tc_mqprio_qdisc()
8670 clear_bit(ICE_RESET_FAILED, pf->state); in ice_setup_tc_mqprio_qdisc()
8686 if (test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) { in ice_setup_tc_mqprio_qdisc()
8739 struct ice_pf *pf = np->vsi->back; in ice_setup_tc() local
8750 mutex_lock(&pf->tc_mutex); in ice_setup_tc()
8752 mutex_unlock(&pf->tc_mutex); in ice_setup_tc()
8890 struct ice_pf *pf = np->vsi->back; in ice_open() local
8892 if (ice_is_reset_in_progress(pf->state)) { in ice_open()
8913 struct ice_pf *pf = vsi->back; in ice_open_internal() local
8917 if (test_bit(ICE_NEEDS_RESTART, pf->state)) { in ice_open_internal()
8931 ice_check_link_cfg_err(pf, pi->phy.link_info.link_cfg_err); in ice_open_internal()
8935 clear_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_open_internal()
8936 if (!test_bit(ICE_PHY_INIT_COMPLETE, pf->state)) { in ice_open_internal()
8952 set_bit(ICE_FLAG_NO_MEDIA, pf->flags); in ice_open_internal()
8981 struct ice_pf *pf = vsi->back; in ice_stop() local
8983 if (ice_is_reset_in_progress(pf->state)) { in ice_stop()