Lines Matching full:pf
15 * @pf: pointer to PF struct
20 static int ice_eswitch_setup_env(struct ice_pf *pf) in ice_eswitch_setup_env() argument
22 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_setup_env()
31 ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx); in ice_eswitch_setup_env()
85 * @pf: poiner to PF struct
89 ice_eswitch_release_repr(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_release_repr() argument
106 * @pf: pointer to PF struct
109 static int ice_eswitch_setup_repr(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_setup_repr() argument
111 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_setup_repr()
178 struct ice_pf *pf = vsi->back; in ice_eswitch_update_repr() local
182 if (!ice_is_switchdev_running(pf)) in ice_eswitch_update_repr()
185 repr = xa_load(&pf->eswitch.reprs, *repr_id); in ice_eswitch_update_repr()
197 dev_err(ice_pf_to_dev(pf), "Failed to update VSI of port representor %d", in ice_eswitch_update_repr()
202 xa_erase(&pf->eswitch.reprs, repr->id); in ice_eswitch_update_repr()
204 if (xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL)) in ice_eswitch_update_repr()
205 dev_err(ice_pf_to_dev(pf), "Failed to reload port representor %d", in ice_eswitch_update_repr()
265 * @pf: pointer to PF struct
270 static void ice_eswitch_release_env(struct ice_pf *pf) in ice_eswitch_release_env() argument
272 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_release_env()
291 * @pf: pointer to PF structure
293 static int ice_eswitch_enable_switchdev(struct ice_pf *pf) in ice_eswitch_enable_switchdev() argument
297 uplink_vsi = ice_get_main_vsi(pf); in ice_eswitch_enable_switchdev()
302 dev_err(ice_pf_to_dev(pf), in ice_eswitch_enable_switchdev()
307 pf->eswitch.uplink_vsi = uplink_vsi; in ice_eswitch_enable_switchdev()
309 if (ice_eswitch_setup_env(pf)) in ice_eswitch_enable_switchdev()
312 if (ice_eswitch_br_offloads_init(pf)) in ice_eswitch_enable_switchdev()
315 pf->eswitch.is_running = true; in ice_eswitch_enable_switchdev()
320 ice_eswitch_release_env(pf); in ice_eswitch_enable_switchdev()
326 * @pf: pointer to PF structure
328 static void ice_eswitch_disable_switchdev(struct ice_pf *pf) in ice_eswitch_disable_switchdev() argument
330 ice_eswitch_br_offloads_deinit(pf); in ice_eswitch_disable_switchdev()
331 ice_eswitch_release_env(pf); in ice_eswitch_disable_switchdev()
333 pf->eswitch.is_running = false; in ice_eswitch_disable_switchdev()
346 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_set() local
348 if (pf->eswitch_mode == mode) in ice_eswitch_mode_set()
351 if (ice_has_vfs(pf)) { in ice_eswitch_mode_set()
352 dev_info(ice_pf_to_dev(pf), "Changing eswitch mode is allowed only if there is no VFs created"); in ice_eswitch_mode_set()
359 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy", in ice_eswitch_mode_set()
360 pf->hw.pf_id); in ice_eswitch_mode_set()
361 xa_destroy(&pf->eswitch.reprs); in ice_eswitch_mode_set()
366 if (ice_is_adq_active(pf)) { in ice_eswitch_mode_set()
367 …ice_pf_to_dev(pf), "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs … in ice_eswitch_mode_set()
368 …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()
372 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev", in ice_eswitch_mode_set()
373 pf->hw.pf_id); in ice_eswitch_mode_set()
374 xa_init(&pf->eswitch.reprs); in ice_eswitch_mode_set()
383 pf->eswitch_mode = mode; in ice_eswitch_mode_set()
394 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_get() local
396 *mode = pf->eswitch_mode; in ice_eswitch_mode_get()
402 * @pf: pointer to PF structure
407 bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf) in ice_is_eswitch_mode_switchdev() argument
409 return pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV; in ice_is_eswitch_mode_switchdev()
414 * @pf: pointer to PF structure
416 static void ice_eswitch_start_all_tx_queues(struct ice_pf *pf) in ice_eswitch_start_all_tx_queues() argument
421 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_start_all_tx_queues()
424 xa_for_each(&pf->eswitch.reprs, id, repr) in ice_eswitch_start_all_tx_queues()
430 * @pf: pointer to PF structure
432 void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) in ice_eswitch_stop_all_tx_queues() argument
437 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_stop_all_tx_queues()
440 xa_for_each(&pf->eswitch.reprs, id, repr) in ice_eswitch_stop_all_tx_queues()
444 static void ice_eswitch_stop_reprs(struct ice_pf *pf) in ice_eswitch_stop_reprs() argument
446 ice_eswitch_stop_all_tx_queues(pf); in ice_eswitch_stop_reprs()
449 static void ice_eswitch_start_reprs(struct ice_pf *pf) in ice_eswitch_start_reprs() argument
451 ice_eswitch_start_all_tx_queues(pf); in ice_eswitch_start_reprs()
455 ice_eswitch_attach(struct ice_pf *pf, struct ice_repr *repr, unsigned long *id) in ice_eswitch_attach() argument
459 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY) in ice_eswitch_attach()
462 if (xa_empty(&pf->eswitch.reprs)) { in ice_eswitch_attach()
463 err = ice_eswitch_enable_switchdev(pf); in ice_eswitch_attach()
468 ice_eswitch_stop_reprs(pf); in ice_eswitch_attach()
474 err = ice_eswitch_setup_repr(pf, repr); in ice_eswitch_attach()
478 err = xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL); in ice_eswitch_attach()
484 ice_eswitch_start_reprs(pf); in ice_eswitch_attach()
489 ice_eswitch_release_repr(pf, repr); in ice_eswitch_attach()
493 if (xa_empty(&pf->eswitch.reprs)) in ice_eswitch_attach()
494 ice_eswitch_disable_switchdev(pf); in ice_eswitch_attach()
495 ice_eswitch_start_reprs(pf); in ice_eswitch_attach()
502 * @pf: pointer to PF structure
509 int ice_eswitch_attach_vf(struct ice_pf *pf, struct ice_vf *vf) in ice_eswitch_attach_vf() argument
511 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_attach_vf()
515 if (!ice_is_eswitch_mode_switchdev(pf)) in ice_eswitch_attach_vf()
523 err = ice_eswitch_attach(pf, repr, &vf->repr_id); in ice_eswitch_attach_vf()
533 * @pf: pointer to PF structure
540 int ice_eswitch_attach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf) in ice_eswitch_attach_sf() argument
548 err = ice_eswitch_attach(pf, repr, &sf->repr_id); in ice_eswitch_attach_sf()
555 static void ice_eswitch_detach(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_detach() argument
557 ice_eswitch_stop_reprs(pf); in ice_eswitch_detach()
560 xa_erase(&pf->eswitch.reprs, repr->id); in ice_eswitch_detach()
562 if (xa_empty(&pf->eswitch.reprs)) in ice_eswitch_detach()
563 ice_eswitch_disable_switchdev(pf); in ice_eswitch_detach()
565 ice_eswitch_release_repr(pf, repr); in ice_eswitch_detach()
568 if (xa_empty(&pf->eswitch.reprs)) { in ice_eswitch_detach()
569 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_detach()
574 ice_devlink_rate_clear_tx_topology(ice_get_main_vsi(pf)); in ice_eswitch_detach()
577 ice_eswitch_start_reprs(pf); in ice_eswitch_detach()
583 * @pf: pointer to PF structure
586 void ice_eswitch_detach_vf(struct ice_pf *pf, struct ice_vf *vf) in ice_eswitch_detach_vf() argument
588 struct ice_repr *repr = xa_load(&pf->eswitch.reprs, vf->repr_id); in ice_eswitch_detach_vf()
589 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_detach_vf()
595 ice_eswitch_detach(pf, repr); in ice_eswitch_detach_vf()
601 * @pf: pointer to PF structure
604 void ice_eswitch_detach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf) in ice_eswitch_detach_sf() argument
606 struct ice_repr *repr = xa_load(&pf->eswitch.reprs, sf->repr_id); in ice_eswitch_detach_sf()
611 ice_eswitch_detach(pf, repr); in ice_eswitch_detach_sf()