Lines Matching refs:pf
19 static int ice_eswitch_setup_env(struct ice_pf *pf) in ice_eswitch_setup_env() argument
21 struct ice_vsi *uplink_vsi = pf->switchdev.uplink_vsi; in ice_eswitch_setup_env()
23 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_setup_env()
24 struct ice_port_info *pi = pf->hw.port_info; in ice_eswitch_setup_env()
29 ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx); in ice_eswitch_setup_env()
88 static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf) in ice_eswitch_remap_rings_to_vectors() argument
90 struct ice_vsi *vsi = pf->switchdev.control_vsi; in ice_eswitch_remap_rings_to_vectors()
94 struct ice_repr *repr = pf->vf[q_id].repr; in ice_eswitch_remap_rings_to_vectors()
124 static int ice_eswitch_setup_reprs(struct ice_pf *pf) in ice_eswitch_setup_reprs() argument
126 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_setup_reprs()
130 ice_for_each_vf(pf, i) { in ice_eswitch_setup_reprs()
131 struct ice_vsi *vsi = pf->vf[i].repr->src_vsi; in ice_eswitch_setup_reprs()
132 struct ice_vf *vf = &pf->vf[i]; in ice_eswitch_setup_reprs()
134 ice_remove_vsi_fltr(&pf->hw, vsi->idx); in ice_eswitch_setup_reprs()
178 ice_for_each_vf(pf, i) { in ice_eswitch_setup_reprs()
179 struct ice_repr *repr = pf->vf[i].repr; in ice_eswitch_setup_reprs()
195 struct ice_vsi *vsi = pf->vf[i].repr->src_vsi; in ice_eswitch_setup_reprs()
196 struct ice_vf *vf = &pf->vf[i]; in ice_eswitch_setup_reprs()
213 ice_eswitch_release_reprs(struct ice_pf *pf, struct ice_vsi *ctrl_vsi) in ice_eswitch_release_reprs() argument
218 ice_for_each_vf(pf, i) { in ice_eswitch_release_reprs()
219 struct ice_vsi *vsi = pf->vf[i].repr->src_vsi; in ice_eswitch_release_reprs()
220 struct ice_vf *vf = &pf->vf[i]; in ice_eswitch_release_reprs()
237 struct ice_pf *pf = vsi->back; in ice_eswitch_update_repr() local
242 if (!ice_is_switchdev_running(pf)) in ice_eswitch_update_repr()
245 vf = &pf->vf[vsi->vf_id]; in ice_eswitch_update_repr()
253 dev_err(ice_pf_to_dev(pf), "Failed to update VF %d port representor", vsi->vf_id); in ice_eswitch_update_repr()
316 static void ice_eswitch_release_env(struct ice_pf *pf) in ice_eswitch_release_env() argument
318 struct ice_vsi *uplink_vsi = pf->switchdev.uplink_vsi; in ice_eswitch_release_env()
319 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_release_env()
323 ice_cfg_dflt_vsi(&pf->hw, ctrl_vsi->idx, false, ICE_FLTR_TX); in ice_eswitch_release_env()
336 ice_eswitch_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) in ice_eswitch_vsi_setup() argument
338 return ice_vsi_setup(pf, pi, ICE_VSI_SWITCHDEV_CTRL, ICE_INVAL_VFID, NULL); in ice_eswitch_vsi_setup()
345 static void ice_eswitch_napi_del(struct ice_pf *pf) in ice_eswitch_napi_del() argument
349 ice_for_each_vf(pf, i) in ice_eswitch_napi_del()
350 netif_napi_del(&pf->vf[i].repr->q_vector->napi); in ice_eswitch_napi_del()
357 static void ice_eswitch_napi_enable(struct ice_pf *pf) in ice_eswitch_napi_enable() argument
361 ice_for_each_vf(pf, i) in ice_eswitch_napi_enable()
362 napi_enable(&pf->vf[i].repr->q_vector->napi); in ice_eswitch_napi_enable()
369 static void ice_eswitch_napi_disable(struct ice_pf *pf) in ice_eswitch_napi_disable() argument
373 ice_for_each_vf(pf, i) in ice_eswitch_napi_disable()
374 napi_disable(&pf->vf[i].repr->q_vector->napi); in ice_eswitch_napi_disable()
399 static int ice_eswitch_enable_switchdev(struct ice_pf *pf) in ice_eswitch_enable_switchdev() argument
403 pf->switchdev.control_vsi = ice_eswitch_vsi_setup(pf, pf->hw.port_info); in ice_eswitch_enable_switchdev()
404 if (!pf->switchdev.control_vsi) in ice_eswitch_enable_switchdev()
407 ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_enable_switchdev()
408 pf->switchdev.uplink_vsi = ice_get_main_vsi(pf); in ice_eswitch_enable_switchdev()
409 if (!pf->switchdev.uplink_vsi) in ice_eswitch_enable_switchdev()
412 if (ice_eswitch_setup_env(pf)) in ice_eswitch_enable_switchdev()
415 if (ice_repr_add_for_all_vfs(pf)) in ice_eswitch_enable_switchdev()
418 if (ice_eswitch_setup_reprs(pf)) in ice_eswitch_enable_switchdev()
421 ice_eswitch_remap_rings_to_vectors(pf); in ice_eswitch_enable_switchdev()
426 ice_eswitch_napi_enable(pf); in ice_eswitch_enable_switchdev()
433 ice_repr_rem_from_all_vfs(pf); in ice_eswitch_enable_switchdev()
435 ice_eswitch_release_env(pf); in ice_eswitch_enable_switchdev()
445 static void ice_eswitch_disable_switchdev(struct ice_pf *pf) in ice_eswitch_disable_switchdev() argument
447 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_disable_switchdev()
449 ice_eswitch_napi_disable(pf); in ice_eswitch_disable_switchdev()
450 ice_eswitch_release_env(pf); in ice_eswitch_disable_switchdev()
451 ice_eswitch_release_reprs(pf, ctrl_vsi); in ice_eswitch_disable_switchdev()
453 ice_repr_rem_from_all_vfs(pf); in ice_eswitch_disable_switchdev()
466 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_set() local
468 if (pf->eswitch_mode == mode) in ice_eswitch_mode_set()
471 if (pf->num_alloc_vfs) { in ice_eswitch_mode_set()
472 dev_info(ice_pf_to_dev(pf), "Changing eswitch mode is allowed only if there is no VFs created"); in ice_eswitch_mode_set()
479 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy", in ice_eswitch_mode_set()
480 pf->hw.pf_id); in ice_eswitch_mode_set()
485 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev", in ice_eswitch_mode_set()
486 pf->hw.pf_id); in ice_eswitch_mode_set()
495 pf->eswitch_mode = mode; in ice_eswitch_mode_set()
534 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_get() local
536 *mode = pf->eswitch_mode; in ice_eswitch_mode_get()
547 bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf) in ice_is_eswitch_mode_switchdev() argument
549 return pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV; in ice_is_eswitch_mode_switchdev()
556 void ice_eswitch_release(struct ice_pf *pf) in ice_eswitch_release() argument
558 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY) in ice_eswitch_release()
561 ice_eswitch_disable_switchdev(pf); in ice_eswitch_release()
562 pf->switchdev.is_running = false; in ice_eswitch_release()
569 int ice_eswitch_configure(struct ice_pf *pf) in ice_eswitch_configure() argument
573 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY || pf->switchdev.is_running) in ice_eswitch_configure()
576 status = ice_eswitch_enable_switchdev(pf); in ice_eswitch_configure()
580 pf->switchdev.is_running = true; in ice_eswitch_configure()
588 static void ice_eswitch_start_all_tx_queues(struct ice_pf *pf) in ice_eswitch_start_all_tx_queues() argument
593 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_start_all_tx_queues()
596 ice_for_each_vf(pf, i) { in ice_eswitch_start_all_tx_queues()
597 repr = pf->vf[i].repr; in ice_eswitch_start_all_tx_queues()
607 void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) in ice_eswitch_stop_all_tx_queues() argument
612 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_stop_all_tx_queues()
615 ice_for_each_vf(pf, i) { in ice_eswitch_stop_all_tx_queues()
616 repr = pf->vf[i].repr; in ice_eswitch_stop_all_tx_queues()
626 int ice_eswitch_rebuild(struct ice_pf *pf) in ice_eswitch_rebuild() argument
628 struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; in ice_eswitch_rebuild()
631 ice_eswitch_napi_disable(pf); in ice_eswitch_rebuild()
632 ice_eswitch_napi_del(pf); in ice_eswitch_rebuild()
634 status = ice_eswitch_setup_env(pf); in ice_eswitch_rebuild()
638 status = ice_eswitch_setup_reprs(pf); in ice_eswitch_rebuild()
642 ice_eswitch_remap_rings_to_vectors(pf); in ice_eswitch_rebuild()
644 ice_replay_tc_fltrs(pf); in ice_eswitch_rebuild()
650 ice_eswitch_napi_enable(pf); in ice_eswitch_rebuild()
652 ice_eswitch_start_all_tx_queues(pf); in ice_eswitch_rebuild()