Lines Matching full:pf
15 * @pf: pointer to the PF struct
20 static void ice_eswitch_del_sp_rules(struct ice_pf *pf) in ice_eswitch_del_sp_rules() argument
25 xa_for_each(&pf->eswitch.reprs, id, repr) { in ice_eswitch_del_sp_rules()
27 ice_rem_adv_rule_by_id(&pf->hw, &repr->sp_rule); in ice_eswitch_del_sp_rules()
33 * @pf: pointer to PF struct
39 static int ice_eswitch_add_sp_rule(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_add_sp_rule() argument
41 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_add_sp_rule()
44 struct ice_hw *hw = &pf->hw; in ice_eswitch_add_sp_rule()
67 dev_err(ice_pf_to_dev(pf), "Unable to add slow-path rule for eswitch for PR %d", in ice_eswitch_add_sp_rule()
75 ice_eswitch_add_sp_rules(struct ice_pf *pf) in ice_eswitch_add_sp_rules() argument
81 xa_for_each(&pf->eswitch.reprs, id, repr) { in ice_eswitch_add_sp_rules()
82 err = ice_eswitch_add_sp_rule(pf, repr); in ice_eswitch_add_sp_rules()
84 ice_eswitch_del_sp_rules(pf); in ice_eswitch_add_sp_rules()
94 * @pf: pointer to PF struct
99 static int ice_eswitch_setup_env(struct ice_pf *pf) in ice_eswitch_setup_env() argument
101 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_setup_env()
102 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_setup_env()
107 ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx); in ice_eswitch_setup_env()
211 * @pf: poiner to PF struct
215 ice_eswitch_release_repr(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_release_repr() argument
234 * @pf: pointer to PF struct
237 static int ice_eswitch_setup_repr(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_setup_repr() argument
239 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_setup_repr()
243 ice_remove_vsi_fltr(&pf->hw, vsi->idx); in ice_eswitch_setup_repr()
285 struct ice_pf *pf = vsi->back; in ice_eswitch_update_repr() local
289 if (!ice_is_switchdev_running(pf)) in ice_eswitch_update_repr()
292 repr = xa_load(&pf->eswitch.reprs, repr_id); in ice_eswitch_update_repr()
306 dev_err(ice_pf_to_dev(pf), "Failed to update VSI of port representor %d", in ice_eswitch_update_repr()
369 * @pf: pointer to PF struct
374 static void ice_eswitch_release_env(struct ice_pf *pf) in ice_eswitch_release_env() argument
376 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_release_env()
377 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_release_env()
394 * @pf: pointer to PF structure
398 ice_eswitch_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_eswitch_vsi_setup() argument
406 return ice_vsi_setup(pf, ¶ms); in ice_eswitch_vsi_setup()
437 * @pf: pointer to PF structure
439 static int ice_eswitch_enable_switchdev(struct ice_pf *pf) in ice_eswitch_enable_switchdev() argument
443 uplink_vsi = ice_get_main_vsi(pf); in ice_eswitch_enable_switchdev()
448 dev_err(ice_pf_to_dev(pf), in ice_eswitch_enable_switchdev()
453 pf->eswitch.control_vsi = ice_eswitch_vsi_setup(pf, pf->hw.port_info); in ice_eswitch_enable_switchdev()
454 if (!pf->eswitch.control_vsi) in ice_eswitch_enable_switchdev()
457 ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_enable_switchdev()
459 pf->eswitch.qs.value = 1; in ice_eswitch_enable_switchdev()
460 pf->eswitch.uplink_vsi = uplink_vsi; in ice_eswitch_enable_switchdev()
462 if (ice_eswitch_setup_env(pf)) in ice_eswitch_enable_switchdev()
465 if (ice_eswitch_br_offloads_init(pf)) in ice_eswitch_enable_switchdev()
468 pf->eswitch.is_running = true; in ice_eswitch_enable_switchdev()
473 ice_eswitch_release_env(pf); in ice_eswitch_enable_switchdev()
481 * @pf: pointer to PF structure
483 static void ice_eswitch_disable_switchdev(struct ice_pf *pf) in ice_eswitch_disable_switchdev() argument
485 struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; in ice_eswitch_disable_switchdev()
487 ice_eswitch_br_offloads_deinit(pf); in ice_eswitch_disable_switchdev()
488 ice_eswitch_release_env(pf); in ice_eswitch_disable_switchdev()
491 pf->eswitch.is_running = false; in ice_eswitch_disable_switchdev()
492 pf->eswitch.qs.is_reaching = false; in ice_eswitch_disable_switchdev()
505 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_set() local
507 if (pf->eswitch_mode == mode) in ice_eswitch_mode_set()
510 if (ice_has_vfs(pf)) { in ice_eswitch_mode_set()
511 dev_info(ice_pf_to_dev(pf), "Changing eswitch mode is allowed only if there is no VFs created"); in ice_eswitch_mode_set()
518 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy", in ice_eswitch_mode_set()
519 pf->hw.pf_id); in ice_eswitch_mode_set()
520 xa_destroy(&pf->eswitch.reprs); in ice_eswitch_mode_set()
525 if (ice_is_adq_active(pf)) { in ice_eswitch_mode_set()
526 …ice_pf_to_dev(pf), "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs … in ice_eswitch_mode_set()
527 …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()
531 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev", in ice_eswitch_mode_set()
532 pf->hw.pf_id); in ice_eswitch_mode_set()
533 xa_init_flags(&pf->eswitch.reprs, XA_FLAGS_ALLOC); in ice_eswitch_mode_set()
542 pf->eswitch_mode = mode; in ice_eswitch_mode_set()
553 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_get() local
555 *mode = pf->eswitch_mode; in ice_eswitch_mode_get()
561 * @pf: pointer to PF structure
566 bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf) in ice_is_eswitch_mode_switchdev() argument
568 return pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV; in ice_is_eswitch_mode_switchdev()
573 * @pf: pointer to PF structure
575 static void ice_eswitch_start_all_tx_queues(struct ice_pf *pf) in ice_eswitch_start_all_tx_queues() argument
580 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_start_all_tx_queues()
583 xa_for_each(&pf->eswitch.reprs, id, repr) in ice_eswitch_start_all_tx_queues()
589 * @pf: pointer to PF structure
591 void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) in ice_eswitch_stop_all_tx_queues() argument
596 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_stop_all_tx_queues()
599 xa_for_each(&pf->eswitch.reprs, id, repr) in ice_eswitch_stop_all_tx_queues()
603 static void ice_eswitch_stop_reprs(struct ice_pf *pf) in ice_eswitch_stop_reprs() argument
605 ice_eswitch_del_sp_rules(pf); in ice_eswitch_stop_reprs()
606 ice_eswitch_stop_all_tx_queues(pf); in ice_eswitch_stop_reprs()
607 ice_eswitch_napi_disable(&pf->eswitch.reprs); in ice_eswitch_stop_reprs()
610 static void ice_eswitch_start_reprs(struct ice_pf *pf) in ice_eswitch_start_reprs() argument
612 ice_eswitch_napi_enable(&pf->eswitch.reprs); in ice_eswitch_start_reprs()
613 ice_eswitch_start_all_tx_queues(pf); in ice_eswitch_start_reprs()
614 ice_eswitch_add_sp_rules(pf); in ice_eswitch_start_reprs()
651 ice_eswitch_attach(struct ice_pf *pf, struct ice_vf *vf) in ice_eswitch_attach() argument
657 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY) in ice_eswitch_attach()
660 if (xa_empty(&pf->eswitch.reprs)) { in ice_eswitch_attach()
661 err = ice_eswitch_enable_switchdev(pf); in ice_eswitch_attach()
665 pf->eswitch.qs.to_reach -= 1; in ice_eswitch_attach()
669 ice_eswitch_stop_reprs(pf); in ice_eswitch_attach()
677 err = ice_eswitch_setup_repr(pf, repr); in ice_eswitch_attach()
681 err = xa_alloc(&pf->eswitch.reprs, &repr->id, repr, in ice_eswitch_attach()
688 ice_eswitch_cp_change_queues(&pf->eswitch, change); in ice_eswitch_attach()
689 ice_eswitch_start_reprs(pf); in ice_eswitch_attach()
694 ice_eswitch_release_repr(pf, repr); in ice_eswitch_attach()
698 if (xa_empty(&pf->eswitch.reprs)) in ice_eswitch_attach()
699 ice_eswitch_disable_switchdev(pf); in ice_eswitch_attach()
700 ice_eswitch_start_reprs(pf); in ice_eswitch_attach()
705 void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf) in ice_eswitch_detach() argument
707 struct ice_repr *repr = xa_load(&pf->eswitch.reprs, vf->repr_id); in ice_eswitch_detach()
708 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_detach()
713 ice_eswitch_stop_reprs(pf); in ice_eswitch_detach()
714 xa_erase(&pf->eswitch.reprs, repr->id); in ice_eswitch_detach()
716 if (xa_empty(&pf->eswitch.reprs)) in ice_eswitch_detach()
717 ice_eswitch_disable_switchdev(pf); in ice_eswitch_detach()
719 ice_eswitch_cp_change_queues(&pf->eswitch, -1); in ice_eswitch_detach()
721 ice_eswitch_release_repr(pf, repr); in ice_eswitch_detach()
724 if (xa_empty(&pf->eswitch.reprs)) { in ice_eswitch_detach()
728 ice_devlink_rate_clear_tx_topology(ice_get_main_vsi(pf)); in ice_eswitch_detach()
733 ice_eswitch_start_reprs(pf); in ice_eswitch_detach()
739 * @pf: pointer to PF structure
741 int ice_eswitch_rebuild(struct ice_pf *pf) in ice_eswitch_rebuild() argument
747 if (!ice_is_switchdev_running(pf)) in ice_eswitch_rebuild()
750 err = ice_vsi_rebuild(pf->eswitch.control_vsi, ICE_VSI_FLAG_INIT); in ice_eswitch_rebuild()
754 xa_for_each(&pf->eswitch.reprs, id, repr) in ice_eswitch_rebuild()
755 ice_eswitch_detach(pf, repr->vf); in ice_eswitch_rebuild()
762 * @pf: pointer to PF structure
767 void ice_eswitch_reserve_cp_queues(struct ice_pf *pf, int change) in ice_eswitch_reserve_cp_queues() argument
769 if (pf->eswitch.qs.value + change < 0) in ice_eswitch_reserve_cp_queues()
772 pf->eswitch.qs.to_reach = pf->eswitch.qs.value + change; in ice_eswitch_reserve_cp_queues()
773 pf->eswitch.qs.is_reaching = true; in ice_eswitch_reserve_cp_queues()