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()
90 * @pf: poiner to PF struct
94 ice_eswitch_release_repr(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_release_repr() argument
111 * @pf: pointer to PF struct
114 static int ice_eswitch_setup_repr(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_setup_repr() argument
116 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_setup_repr()
183 struct ice_pf *pf = vsi->back; in ice_eswitch_update_repr() local
187 if (!ice_is_switchdev_running(pf)) in ice_eswitch_update_repr()
190 repr = xa_load(&pf->eswitch.reprs, *repr_id); in ice_eswitch_update_repr()
202 dev_err(ice_pf_to_dev(pf), "Failed to update VSI of port representor %d", in ice_eswitch_update_repr()
207 xa_erase(&pf->eswitch.reprs, repr->id); in ice_eswitch_update_repr()
209 if (xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL)) in ice_eswitch_update_repr()
210 dev_err(ice_pf_to_dev(pf), "Failed to reload port representor %d", in ice_eswitch_update_repr()
266 * @pf: pointer to PF struct
271 static void ice_eswitch_release_env(struct ice_pf *pf) in ice_eswitch_release_env() argument
273 struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi; in ice_eswitch_release_env()
292 * @pf: pointer to PF structure
294 static int ice_eswitch_enable_switchdev(struct ice_pf *pf) in ice_eswitch_enable_switchdev() argument
298 uplink_vsi = ice_get_main_vsi(pf); in ice_eswitch_enable_switchdev()
303 dev_err(ice_pf_to_dev(pf), in ice_eswitch_enable_switchdev()
308 pf->eswitch.uplink_vsi = uplink_vsi; in ice_eswitch_enable_switchdev()
310 if (ice_eswitch_setup_env(pf)) in ice_eswitch_enable_switchdev()
313 if (ice_eswitch_br_offloads_init(pf)) in ice_eswitch_enable_switchdev()
316 pf->eswitch.is_running = true; in ice_eswitch_enable_switchdev()
321 ice_eswitch_release_env(pf); in ice_eswitch_enable_switchdev()
327 * @pf: pointer to PF structure
329 static void ice_eswitch_disable_switchdev(struct ice_pf *pf) in ice_eswitch_disable_switchdev() argument
331 ice_eswitch_br_offloads_deinit(pf); in ice_eswitch_disable_switchdev()
332 ice_eswitch_release_env(pf); in ice_eswitch_disable_switchdev()
334 pf->eswitch.is_running = false; in ice_eswitch_disable_switchdev()
347 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_set() local
349 if (pf->eswitch_mode == mode) in ice_eswitch_mode_set()
352 if (ice_has_vfs(pf)) { in ice_eswitch_mode_set()
353 dev_info(ice_pf_to_dev(pf), "Changing eswitch mode is allowed only if there is no VFs created"); in ice_eswitch_mode_set()
360 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy", in ice_eswitch_mode_set()
361 pf->hw.pf_id); in ice_eswitch_mode_set()
362 xa_destroy(&pf->eswitch.reprs); in ice_eswitch_mode_set()
367 if (ice_is_adq_active(pf)) { in ice_eswitch_mode_set()
368 …ice_pf_to_dev(pf), "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs … in ice_eswitch_mode_set()
369 …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()
373 dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev", in ice_eswitch_mode_set()
374 pf->hw.pf_id); in ice_eswitch_mode_set()
375 xa_init(&pf->eswitch.reprs); in ice_eswitch_mode_set()
384 pf->eswitch_mode = mode; in ice_eswitch_mode_set()
395 struct ice_pf *pf = devlink_priv(devlink); in ice_eswitch_mode_get() local
397 *mode = pf->eswitch_mode; in ice_eswitch_mode_get()
403 * @pf: pointer to PF structure
408 bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf) in ice_is_eswitch_mode_switchdev() argument
410 return pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV; in ice_is_eswitch_mode_switchdev()
415 * @pf: pointer to PF structure
417 static void ice_eswitch_start_all_tx_queues(struct ice_pf *pf) in ice_eswitch_start_all_tx_queues() argument
422 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_start_all_tx_queues()
425 xa_for_each(&pf->eswitch.reprs, id, repr) in ice_eswitch_start_all_tx_queues()
431 * @pf: pointer to PF structure
433 void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) in ice_eswitch_stop_all_tx_queues() argument
438 if (test_bit(ICE_DOWN, pf->state)) in ice_eswitch_stop_all_tx_queues()
441 xa_for_each(&pf->eswitch.reprs, id, repr) in ice_eswitch_stop_all_tx_queues()
445 static void ice_eswitch_stop_reprs(struct ice_pf *pf) in ice_eswitch_stop_reprs() argument
447 ice_eswitch_stop_all_tx_queues(pf); in ice_eswitch_stop_reprs()
450 static void ice_eswitch_start_reprs(struct ice_pf *pf) in ice_eswitch_start_reprs() argument
452 ice_eswitch_start_all_tx_queues(pf); in ice_eswitch_start_reprs()
456 ice_eswitch_attach(struct ice_pf *pf, struct ice_repr *repr, unsigned long *id) in ice_eswitch_attach() argument
460 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY) in ice_eswitch_attach()
463 if (xa_empty(&pf->eswitch.reprs)) { in ice_eswitch_attach()
464 err = ice_eswitch_enable_switchdev(pf); in ice_eswitch_attach()
469 ice_eswitch_stop_reprs(pf); in ice_eswitch_attach()
475 err = ice_eswitch_setup_repr(pf, repr); in ice_eswitch_attach()
479 err = xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL); in ice_eswitch_attach()
485 ice_eswitch_start_reprs(pf); in ice_eswitch_attach()
490 ice_eswitch_release_repr(pf, repr); in ice_eswitch_attach()
494 if (xa_empty(&pf->eswitch.reprs)) in ice_eswitch_attach()
495 ice_eswitch_disable_switchdev(pf); in ice_eswitch_attach()
496 ice_eswitch_start_reprs(pf); in ice_eswitch_attach()
503 * @pf: pointer to PF structure
510 int ice_eswitch_attach_vf(struct ice_pf *pf, struct ice_vf *vf) in ice_eswitch_attach_vf() argument
513 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_attach_vf()
520 err = ice_eswitch_attach(pf, repr, &vf->repr_id); in ice_eswitch_attach_vf()
530 * @pf: pointer to PF structure
537 int ice_eswitch_attach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf) in ice_eswitch_attach_sf() argument
545 err = ice_eswitch_attach(pf, repr, &sf->repr_id); in ice_eswitch_attach_sf()
552 static void ice_eswitch_detach(struct ice_pf *pf, struct ice_repr *repr) in ice_eswitch_detach() argument
554 ice_eswitch_stop_reprs(pf); in ice_eswitch_detach()
557 xa_erase(&pf->eswitch.reprs, repr->id); in ice_eswitch_detach()
559 if (xa_empty(&pf->eswitch.reprs)) in ice_eswitch_detach()
560 ice_eswitch_disable_switchdev(pf); in ice_eswitch_detach()
562 ice_eswitch_release_repr(pf, repr); in ice_eswitch_detach()
565 if (xa_empty(&pf->eswitch.reprs)) { in ice_eswitch_detach()
566 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_detach()
571 ice_devlink_rate_clear_tx_topology(ice_get_main_vsi(pf)); in ice_eswitch_detach()
574 ice_eswitch_start_reprs(pf); in ice_eswitch_detach()
580 * @pf: pointer to PF structure
583 void ice_eswitch_detach_vf(struct ice_pf *pf, struct ice_vf *vf) in ice_eswitch_detach_vf() argument
585 struct ice_repr *repr = xa_load(&pf->eswitch.reprs, vf->repr_id); in ice_eswitch_detach_vf()
586 struct devlink *devlink = priv_to_devlink(pf); in ice_eswitch_detach_vf()
592 ice_eswitch_detach(pf, repr); in ice_eswitch_detach_vf()
598 * @pf: pointer to PF structure
601 void ice_eswitch_detach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf) in ice_eswitch_detach_sf() argument
603 struct ice_repr *repr = xa_load(&pf->eswitch.reprs, sf->repr_id); in ice_eswitch_detach_sf()
608 ice_eswitch_detach(pf, repr); in ice_eswitch_detach_sf()