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()
84 * @pf: poiner to PF struct
88 ice_eswitch_release_repr(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_release_repr() argument
105 * @pf: pointer to PF struct
108 static int ice_eswitch_setup_repr(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_setup_repr() argument
110 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_setup_repr()
177 struct ice_pf *pf = vsi->back; in ice_eswitch_update_repr() local
181 if (!ice_is_switchdev_running(pf)) in ice_eswitch_update_repr()
184 repr = xa_load(&pf->eswitch.reprs, *repr_id); in ice_eswitch_update_repr()
196 dev_err(ice_pf_to_dev(pf), "Failed to update VSI of port representor %d", in ice_eswitch_update_repr()
201 xa_erase(&pf->eswitch.reprs, repr->id); in ice_eswitch_update_repr()
203 if (xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL)) in ice_eswitch_update_repr()
204 dev_err(ice_pf_to_dev(pf), "Failed to reload port representor %d", in ice_eswitch_update_repr()
260 * @pf: pointer to PF struct
265 static void ice_eswitch_release_env(struct ice_pf *pf) in ice_eswitch_release_env() argument
267 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_release_env()
285 * @pf: pointer to PF structure
287 static int ice_eswitch_enable_switchdev(struct ice_pf *pf) in ice_eswitch_enable_switchdev() argument
291 uplink_vsi = ice_get_main_vsi(pf); in ice_eswitch_enable_switchdev()
296 dev_err(ice_pf_to_dev(pf), in ice_eswitch_enable_switchdev()
301 pf->eswitch.uplink_vsi = uplink_vsi; in ice_eswitch_enable_switchdev()
303 if (ice_eswitch_setup_env(pf)) in ice_eswitch_enable_switchdev()
306 if (ice_eswitch_br_offloads_init(pf)) in ice_eswitch_enable_switchdev()
309 pf->eswitch.is_running = true; in ice_eswitch_enable_switchdev()
314 ice_eswitch_release_env(pf); in ice_eswitch_enable_switchdev()
320 * @pf: pointer to PF structure
322 static void ice_eswitch_disable_switchdev(struct ice_pf *pf) in ice_eswitch_disable_switchdev() argument
324 ice_eswitch_br_offloads_deinit(pf); in ice_eswitch_disable_switchdev()
325 ice_eswitch_release_env(pf); in ice_eswitch_disable_switchdev()
327 pf->eswitch.is_running = false; in ice_eswitch_disable_switchdev()
340 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_set() local
342 if (pf->eswitch_mode == mode) in ice_eswitch_mode_set()
345 if (ice_has_vfs(pf)) { in ice_eswitch_mode_set()
346 dev_info(ice_pf_to_dev(pf), "Changing eswitch mode is allowed only if there is no VFs created"); in ice_eswitch_mode_set()
353 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy", in ice_eswitch_mode_set()
354 pf->hw.pf_id); in ice_eswitch_mode_set()
355 xa_destroy(&pf->eswitch.reprs); in ice_eswitch_mode_set()
360 if (ice_is_adq_active(pf)) { in ice_eswitch_mode_set()
361 …ice_pf_to_dev(pf), "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs … in ice_eswitch_mode_set()
362 …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()
366 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev", in ice_eswitch_mode_set()
367 pf->hw.pf_id); in ice_eswitch_mode_set()
368 xa_init(&pf->eswitch.reprs); in ice_eswitch_mode_set()
377 pf->eswitch_mode = mode; in ice_eswitch_mode_set()
388 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_get() local
390 *mode = pf->eswitch_mode; in ice_eswitch_mode_get()
396 * @pf: pointer to PF structure
401 bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf) in ice_is_eswitch_mode_switchdev() argument
403 return pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV; in ice_is_eswitch_mode_switchdev()
408 * @pf: pointer to PF structure
410 static void ice_eswitch_start_all_tx_queues(struct ice_pf *pf) in ice_eswitch_start_all_tx_queues() argument
415 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_start_all_tx_queues()
418 xa_for_each(&pf->eswitch.reprs, id, repr) in ice_eswitch_start_all_tx_queues()
424 * @pf: pointer to PF structure
426 void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) in ice_eswitch_stop_all_tx_queues() argument
431 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_stop_all_tx_queues()
434 xa_for_each(&pf->eswitch.reprs, id, repr) in ice_eswitch_stop_all_tx_queues()
438 static void ice_eswitch_stop_reprs(struct ice_pf *pf) in ice_eswitch_stop_reprs() argument
440 ice_eswitch_stop_all_tx_queues(pf); in ice_eswitch_stop_reprs()
443 static void ice_eswitch_start_reprs(struct ice_pf *pf) in ice_eswitch_start_reprs() argument
445 ice_eswitch_start_all_tx_queues(pf); in ice_eswitch_start_reprs()
449 ice_eswitch_attach(struct ice_pf *pf, struct ice_repr *repr, unsigned long *id) in ice_eswitch_attach() argument
453 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY) in ice_eswitch_attach()
456 if (xa_empty(&pf->eswitch.reprs)) { in ice_eswitch_attach()
457 err = ice_eswitch_enable_switchdev(pf); in ice_eswitch_attach()
462 ice_eswitch_stop_reprs(pf); in ice_eswitch_attach()
468 err = ice_eswitch_setup_repr(pf, repr); in ice_eswitch_attach()
472 err = xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL); in ice_eswitch_attach()
478 ice_eswitch_start_reprs(pf); in ice_eswitch_attach()
483 ice_eswitch_release_repr(pf, repr); in ice_eswitch_attach()
487 if (xa_empty(&pf->eswitch.reprs)) in ice_eswitch_attach()
488 ice_eswitch_disable_switchdev(pf); in ice_eswitch_attach()
489 ice_eswitch_start_reprs(pf); in ice_eswitch_attach()
496 * @pf: pointer to PF structure
503 int ice_eswitch_attach_vf(struct ice_pf *pf, struct ice_vf *vf) in ice_eswitch_attach_vf() argument
506 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_attach_vf()
513 err = ice_eswitch_attach(pf, repr, &vf->repr_id); in ice_eswitch_attach_vf()
523 * @pf: pointer to PF structure
530 int ice_eswitch_attach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf) in ice_eswitch_attach_sf() argument
538 err = ice_eswitch_attach(pf, repr, &sf->repr_id); in ice_eswitch_attach_sf()
545 static void ice_eswitch_detach(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_detach() argument
547 ice_eswitch_stop_reprs(pf); in ice_eswitch_detach()
550 xa_erase(&pf->eswitch.reprs, repr->id); in ice_eswitch_detach()
552 if (xa_empty(&pf->eswitch.reprs)) in ice_eswitch_detach()
553 ice_eswitch_disable_switchdev(pf); in ice_eswitch_detach()
555 ice_eswitch_release_repr(pf, repr); in ice_eswitch_detach()
558 if (xa_empty(&pf->eswitch.reprs)) { in ice_eswitch_detach()
559 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_detach()
564 ice_devlink_rate_clear_tx_topology(ice_get_main_vsi(pf)); in ice_eswitch_detach()
567 ice_eswitch_start_reprs(pf); in ice_eswitch_detach()
573 * @pf: pointer to PF structure
576 void ice_eswitch_detach_vf(struct ice_pf *pf, struct ice_vf *vf) in ice_eswitch_detach_vf() argument
578 struct ice_repr *repr = xa_load(&pf->eswitch.reprs, vf->repr_id); in ice_eswitch_detach_vf()
579 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_detach_vf()
585 ice_eswitch_detach(pf, repr); in ice_eswitch_detach_vf()
591 * @pf: pointer to PF structure
594 void ice_eswitch_detach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf) in ice_eswitch_detach_sf() argument
596 struct ice_repr *repr = xa_load(&pf->eswitch.reprs, sf->repr_id); in ice_eswitch_detach_sf()
601 ice_eswitch_detach(pf, repr); in ice_eswitch_detach_sf()