Lines Matching full:pf

15  * @pf: pointer to PF struct
22 ice_eswitch_add_vf_sp_rule(struct ice_pf *pf, struct ice_vf *vf) in ice_eswitch_add_vf_sp_rule() argument
24 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_add_vf_sp_rule()
27 struct ice_hw *hw = &pf->hw; in ice_eswitch_add_vf_sp_rule()
50 dev_err(ice_pf_to_dev(pf), "Unable to add VF slow-path rule in switchdev mode for VF %d", in ice_eswitch_add_vf_sp_rule()
69 ice_rem_adv_rule_by_id(&vf->pf->hw, &vf->repr->sp_rule); in ice_eswitch_del_vf_sp_rule()
74 * @pf: pointer to PF struct
79 static int ice_eswitch_setup_env(struct ice_pf *pf) in ice_eswitch_setup_env() argument
81 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_setup_env()
82 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_setup_env()
87 ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx); in ice_eswitch_setup_env()
136 * @pf: pointer to PF struct
145 static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf) in ice_eswitch_remap_rings_to_vectors() argument
147 struct ice_vsi *vsi = pf->eswitch.control_vsi; in ice_eswitch_remap_rings_to_vectors()
157 vf = ice_get_vf_by_id(pf, q_id); in ice_eswitch_remap_rings_to_vectors()
191 * @pf: poiner to PF struct
195 ice_eswitch_release_reprs(struct ice_pf *pf, struct ice_vsi *ctrl_vsi) in ice_eswitch_release_reprs() argument
200 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_release_reprs()
202 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_release_reprs()
222 * @pf: pointer to PF struct
224 static int ice_eswitch_setup_reprs(struct ice_pf *pf) in ice_eswitch_setup_reprs() argument
226 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_setup_reprs()
231 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_setup_reprs()
233 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_setup_reprs()
236 ice_remove_vsi_fltr(&pf->hw, vsi->idx); in ice_eswitch_setup_reprs()
245 if (ice_eswitch_add_vf_sp_rule(pf, vf)) { in ice_eswitch_setup_reprs()
279 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_setup_reprs()
293 ice_eswitch_release_reprs(pf, ctrl_vsi); in ice_eswitch_setup_reprs()
304 struct ice_pf *pf = vsi->back; in ice_eswitch_update_repr() local
309 if (!ice_is_switchdev_running(pf)) in ice_eswitch_update_repr()
323 dev_err(ice_pf_to_dev(pf), "Failed to update VF %d port representor", in ice_eswitch_update_repr()
386 * @pf: pointer to PF struct
391 static void ice_eswitch_release_env(struct ice_pf *pf) in ice_eswitch_release_env() argument
393 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_release_env()
394 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_release_env()
411 * @pf: pointer to PF structure
415 ice_eswitch_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_eswitch_vsi_setup() argument
423 return ice_vsi_setup(pf, &params); in ice_eswitch_vsi_setup()
428 * @pf: pointer to PF structure
430 static void ice_eswitch_napi_del(struct ice_pf *pf) in ice_eswitch_napi_del() argument
435 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_napi_del()
437 ice_for_each_vf(pf, bkt, vf) in ice_eswitch_napi_del()
443 * @pf: pointer to PF structure
445 static void ice_eswitch_napi_enable(struct ice_pf *pf) in ice_eswitch_napi_enable() argument
450 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_napi_enable()
452 ice_for_each_vf(pf, bkt, vf) in ice_eswitch_napi_enable()
458 * @pf: pointer to PF structure
460 static void ice_eswitch_napi_disable(struct ice_pf *pf) in ice_eswitch_napi_disable() argument
465 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_napi_disable()
467 ice_for_each_vf(pf, bkt, vf) in ice_eswitch_napi_disable()
473 * @pf: pointer to PF structure
475 static int ice_eswitch_enable_switchdev(struct ice_pf *pf) in ice_eswitch_enable_switchdev() argument
479 uplink_vsi = ice_get_main_vsi(pf); in ice_eswitch_enable_switchdev()
484 dev_err(ice_pf_to_dev(pf), in ice_eswitch_enable_switchdev()
489 pf->eswitch.control_vsi = ice_eswitch_vsi_setup(pf, pf->hw.port_info); in ice_eswitch_enable_switchdev()
490 if (!pf->eswitch.control_vsi) in ice_eswitch_enable_switchdev()
493 ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_enable_switchdev()
494 pf->eswitch.uplink_vsi = uplink_vsi; in ice_eswitch_enable_switchdev()
496 if (ice_eswitch_setup_env(pf)) in ice_eswitch_enable_switchdev()
499 if (ice_repr_add_for_all_vfs(pf)) in ice_eswitch_enable_switchdev()
502 if (ice_eswitch_setup_reprs(pf)) in ice_eswitch_enable_switchdev()
505 ice_eswitch_remap_rings_to_vectors(pf); in ice_eswitch_enable_switchdev()
510 if (ice_eswitch_br_offloads_init(pf)) in ice_eswitch_enable_switchdev()
513 ice_eswitch_napi_enable(pf); in ice_eswitch_enable_switchdev()
520 ice_repr_rem_from_all_vfs(pf); in ice_eswitch_enable_switchdev()
522 ice_eswitch_release_env(pf); in ice_eswitch_enable_switchdev()
530 * @pf: pointer to PF structure
532 static void ice_eswitch_disable_switchdev(struct ice_pf *pf) in ice_eswitch_disable_switchdev() argument
534 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_disable_switchdev()
536 ice_eswitch_napi_disable(pf); in ice_eswitch_disable_switchdev()
537 ice_eswitch_br_offloads_deinit(pf); in ice_eswitch_disable_switchdev()
538 ice_eswitch_release_env(pf); in ice_eswitch_disable_switchdev()
539 ice_eswitch_release_reprs(pf, ctrl_vsi); in ice_eswitch_disable_switchdev()
541 ice_repr_rem_from_all_vfs(pf); in ice_eswitch_disable_switchdev()
554 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_set() local
556 if (pf->eswitch_mode == mode) in ice_eswitch_mode_set()
559 if (ice_has_vfs(pf)) { in ice_eswitch_mode_set()
560 dev_info(ice_pf_to_dev(pf), "Changing eswitch mode is allowed only if there is no VFs created"); in ice_eswitch_mode_set()
567 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy", in ice_eswitch_mode_set()
568 pf->hw.pf_id); in ice_eswitch_mode_set()
573 if (ice_is_adq_active(pf)) { in ice_eswitch_mode_set()
574 …ice_pf_to_dev(pf), "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs … in ice_eswitch_mode_set()
575 …e to switchdev - ADQ is active. Delete ADQ configs and try again, e.g. tc qdisc del dev $PF root"); in ice_eswitch_mode_set()
579 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev", in ice_eswitch_mode_set()
580 pf->hw.pf_id); in ice_eswitch_mode_set()
589 pf->eswitch_mode = mode; in ice_eswitch_mode_set()
600 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_get() local
602 *mode = pf->eswitch_mode; in ice_eswitch_mode_get()
608 * @pf: pointer to PF structure
613 bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf) in ice_is_eswitch_mode_switchdev() argument
615 return pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV; in ice_is_eswitch_mode_switchdev()
620 * @pf: pointer to PF structure
622 void ice_eswitch_release(struct ice_pf *pf) in ice_eswitch_release() argument
624 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY) in ice_eswitch_release()
627 ice_eswitch_disable_switchdev(pf); in ice_eswitch_release()
628 pf->eswitch.is_running = false; in ice_eswitch_release()
633 * @pf: pointer to PF structure
635 int ice_eswitch_configure(struct ice_pf *pf) in ice_eswitch_configure() argument
639 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY || in ice_eswitch_configure()
640 pf->eswitch.is_running) in ice_eswitch_configure()
643 status = ice_eswitch_enable_switchdev(pf); in ice_eswitch_configure()
647 pf->eswitch.is_running = true; in ice_eswitch_configure()
653 * @pf: pointer to PF structure
655 static void ice_eswitch_start_all_tx_queues(struct ice_pf *pf) in ice_eswitch_start_all_tx_queues() argument
660 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_start_all_tx_queues()
662 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_start_all_tx_queues()
665 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_start_all_tx_queues()
673 * @pf: pointer to PF structure
675 void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) in ice_eswitch_stop_all_tx_queues() argument
680 lockdep_assert_held(&pf->vfs.table_lock); in ice_eswitch_stop_all_tx_queues()
682 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_stop_all_tx_queues()
685 ice_for_each_vf(pf, bkt, vf) { in ice_eswitch_stop_all_tx_queues()
693 * @pf: pointer to PF structure
695 int ice_eswitch_rebuild(struct ice_pf *pf) in ice_eswitch_rebuild() argument
697 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_rebuild()
700 ice_eswitch_napi_disable(pf); in ice_eswitch_rebuild()
701 ice_eswitch_napi_del(pf); in ice_eswitch_rebuild()
703 status = ice_eswitch_setup_env(pf); in ice_eswitch_rebuild()
707 status = ice_eswitch_setup_reprs(pf); in ice_eswitch_rebuild()
711 ice_eswitch_remap_rings_to_vectors(pf); in ice_eswitch_rebuild()
713 ice_replay_tc_fltrs(pf); in ice_eswitch_rebuild()
719 ice_eswitch_napi_enable(pf); in ice_eswitch_rebuild()
720 ice_eswitch_start_all_tx_queues(pf); in ice_eswitch_rebuild()