Lines Matching refs:pf

22 ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf, const u8 *mac)  in ice_eswitch_add_vf_mac_rule()  argument
24 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_add_vf_mac_rule()
27 struct ice_hw *hw = &pf->hw; in ice_eswitch_add_vf_mac_rule()
52 dev_err(ice_pf_to_dev(pf), "Unable to add VF mac rule in switchdev mode for VF %d", in ice_eswitch_add_vf_mac_rule()
71 if (!ice_is_switchdev_running(vf->pf)) in ice_eswitch_replay_vf_mac_rule()
75 err = ice_eswitch_add_vf_mac_rule(vf->pf, vf, in ice_eswitch_replay_vf_mac_rule()
78 dev_err(ice_pf_to_dev(vf->pf), "Failed to add MAC %pM for VF %d\n, error %d\n", in ice_eswitch_replay_vf_mac_rule()
97 if (!ice_is_switchdev_running(vf->pf)) in ice_eswitch_del_vf_mac_rule()
103 ice_rem_adv_rule_by_id(&vf->pf->hw, vf->repr->mac_rule); in ice_eswitch_del_vf_mac_rule()
114 static int ice_eswitch_setup_env(struct ice_pf *pf) in ice_eswitch_setup_env() argument
116 struct ice_vsi *uplink_vsi = pf->switchdev.uplink_vsi; in ice_eswitch_setup_env()
118 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_setup_env()
126 ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx); in ice_eswitch_setup_env()
173 static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf) in ice_eswitch_remap_rings_to_vectors() argument
175 struct ice_vsi *vsi = pf->switchdev.control_vsi; in ice_eswitch_remap_rings_to_vectors()
185 vf = ice_get_vf_by_id(pf, q_id); in ice_eswitch_remap_rings_to_vectors()
223 ice_eswitch_release_reprs(struct ice_pf *pf, struct ice_vsi *ctrl_vsi) in ice_eswitch_release_reprs() argument
228 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_release_reprs()
230 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_release_reprs()
251 static int ice_eswitch_setup_reprs(struct ice_pf *pf) in ice_eswitch_setup_reprs() argument
253 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_setup_reprs()
258 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_setup_reprs()
260 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_setup_reprs()
263 ice_remove_vsi_fltr(&pf->hw, vsi->idx); in ice_eswitch_setup_reprs()
301 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_setup_reprs()
315 ice_eswitch_release_reprs(pf, ctrl_vsi); in ice_eswitch_setup_reprs()
326 struct ice_pf *pf = vsi->back; in ice_eswitch_update_repr() local
331 if (!ice_is_switchdev_running(pf)) in ice_eswitch_update_repr()
342 dev_err(ice_pf_to_dev(pf), "Failed to update VF %d port representor", in ice_eswitch_update_repr()
407 static void ice_eswitch_release_env(struct ice_pf *pf) in ice_eswitch_release_env() argument
409 struct ice_vsi *uplink_vsi = pf->switchdev.uplink_vsi; in ice_eswitch_release_env()
410 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_release_env()
426 ice_eswitch_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_eswitch_vsi_setup() argument
428 return ice_vsi_setup(pf, pi, ICE_VSI_SWITCHDEV_CTRL, NULL, NULL); in ice_eswitch_vsi_setup()
435 static void ice_eswitch_napi_del(struct ice_pf *pf) in ice_eswitch_napi_del() argument
440 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_napi_del()
442 ice_for_each_vf(pf, bkt, vf) in ice_eswitch_napi_del()
450 static void ice_eswitch_napi_enable(struct ice_pf *pf) in ice_eswitch_napi_enable() argument
455 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_napi_enable()
457 ice_for_each_vf(pf, bkt, vf) in ice_eswitch_napi_enable()
465 static void ice_eswitch_napi_disable(struct ice_pf *pf) in ice_eswitch_napi_disable() argument
470 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_napi_disable()
472 ice_for_each_vf(pf, bkt, vf) in ice_eswitch_napi_disable()
480 static int ice_eswitch_enable_switchdev(struct ice_pf *pf) in ice_eswitch_enable_switchdev() argument
484 pf->switchdev.control_vsi = ice_eswitch_vsi_setup(pf, pf->hw.port_info); in ice_eswitch_enable_switchdev()
485 if (!pf->switchdev.control_vsi) in ice_eswitch_enable_switchdev()
488 ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_enable_switchdev()
489 pf->switchdev.uplink_vsi = ice_get_main_vsi(pf); in ice_eswitch_enable_switchdev()
490 if (!pf->switchdev.uplink_vsi) in ice_eswitch_enable_switchdev()
493 if (ice_eswitch_setup_env(pf)) in ice_eswitch_enable_switchdev()
496 if (ice_repr_add_for_all_vfs(pf)) in ice_eswitch_enable_switchdev()
499 if (ice_eswitch_setup_reprs(pf)) in ice_eswitch_enable_switchdev()
502 ice_eswitch_remap_rings_to_vectors(pf); in ice_eswitch_enable_switchdev()
507 ice_eswitch_napi_enable(pf); in ice_eswitch_enable_switchdev()
512 ice_repr_rem_from_all_vfs(pf); in ice_eswitch_enable_switchdev()
514 ice_eswitch_release_env(pf); in ice_eswitch_enable_switchdev()
524 static void ice_eswitch_disable_switchdev(struct ice_pf *pf) in ice_eswitch_disable_switchdev() argument
526 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_disable_switchdev()
528 ice_eswitch_napi_disable(pf); in ice_eswitch_disable_switchdev()
529 ice_eswitch_release_env(pf); in ice_eswitch_disable_switchdev()
530 ice_rem_adv_rule_for_vsi(&pf->hw, ctrl_vsi->idx); in ice_eswitch_disable_switchdev()
531 ice_eswitch_release_reprs(pf, ctrl_vsi); in ice_eswitch_disable_switchdev()
533 ice_repr_rem_from_all_vfs(pf); in ice_eswitch_disable_switchdev()
546 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_set() local
548 if (pf->eswitch_mode == mode) in ice_eswitch_mode_set()
551 if (ice_has_vfs(pf)) { in ice_eswitch_mode_set()
552 dev_info(ice_pf_to_dev(pf), "Changing eswitch mode is allowed only if there is no VFs created"); in ice_eswitch_mode_set()
559 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy", in ice_eswitch_mode_set()
560 pf->hw.pf_id); in ice_eswitch_mode_set()
565 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev", in ice_eswitch_mode_set()
566 pf->hw.pf_id); in ice_eswitch_mode_set()
575 pf->eswitch_mode = mode; in ice_eswitch_mode_set()
586 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_get() local
588 *mode = pf->eswitch_mode; in ice_eswitch_mode_get()
599 bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf) in ice_is_eswitch_mode_switchdev() argument
601 return pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV; in ice_is_eswitch_mode_switchdev()
608 void ice_eswitch_release(struct ice_pf *pf) in ice_eswitch_release() argument
610 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY) in ice_eswitch_release()
613 ice_eswitch_disable_switchdev(pf); in ice_eswitch_release()
614 pf->switchdev.is_running = false; in ice_eswitch_release()
621 int ice_eswitch_configure(struct ice_pf *pf) in ice_eswitch_configure() argument
625 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY || pf->switchdev.is_running) in ice_eswitch_configure()
628 status = ice_eswitch_enable_switchdev(pf); in ice_eswitch_configure()
632 pf->switchdev.is_running = true; in ice_eswitch_configure()
640 static void ice_eswitch_start_all_tx_queues(struct ice_pf *pf) in ice_eswitch_start_all_tx_queues() argument
645 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_start_all_tx_queues()
647 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_start_all_tx_queues()
650 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_start_all_tx_queues()
660 void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) in ice_eswitch_stop_all_tx_queues() argument
665 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_stop_all_tx_queues()
667 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_stop_all_tx_queues()
670 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_stop_all_tx_queues()
680 int ice_eswitch_rebuild(struct ice_pf *pf) in ice_eswitch_rebuild() argument
682 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_rebuild()
685 ice_eswitch_napi_disable(pf); in ice_eswitch_rebuild()
686 ice_eswitch_napi_del(pf); in ice_eswitch_rebuild()
688 status = ice_eswitch_setup_env(pf); in ice_eswitch_rebuild()
692 status = ice_eswitch_setup_reprs(pf); in ice_eswitch_rebuild()
696 ice_eswitch_remap_rings_to_vectors(pf); in ice_eswitch_rebuild()
698 ice_replay_tc_fltrs(pf); in ice_eswitch_rebuild()
704 ice_eswitch_napi_enable(pf); in ice_eswitch_rebuild()
705 ice_eswitch_start_all_tx_queues(pf); in ice_eswitch_rebuild()