Lines Matching refs:app

55 static const char *nfp_flower_extra_cap(struct nfp_app *app, struct nfp_net *nn)  in nfp_flower_extra_cap()  argument
60 static enum devlink_eswitch_mode eswitch_mode_get(struct nfp_app *app) in eswitch_mode_get() argument
66 nfp_flower_repr_get_type_and_port(struct nfp_app *app, u32 port_id, u8 *port) in nfp_flower_repr_get_type_and_port() argument
87 nfp_flower_repr_get(struct nfp_app *app, u32 port_id) in nfp_flower_repr_get() argument
93 repr_type = nfp_flower_repr_get_type_and_port(app, port_id, &port); in nfp_flower_repr_get()
97 reprs = rcu_dereference(app->reprs[repr_type]); in nfp_flower_repr_get()
108 nfp_flower_reprs_reify(struct nfp_app *app, enum nfp_repr_type type, in nfp_flower_reprs_reify() argument
114 reprs = rcu_dereference_protected(app->reprs[type], in nfp_flower_reprs_reify()
115 lockdep_is_held(&app->pf->lock)); in nfp_flower_reprs_reify()
122 netdev = nfp_repr_get_locked(app, reprs, i); in nfp_flower_reprs_reify()
137 nfp_flower_wait_repr_reify(struct nfp_app *app, atomic_t *replies, int tot_repl) in nfp_flower_wait_repr_reify() argument
139 struct nfp_flower_priv *priv = app->priv; in nfp_flower_wait_repr_reify()
145 lockdep_assert_held(&app->pf->lock); in nfp_flower_wait_repr_reify()
150 nfp_warn(app->cpp, "Not all reprs responded to reify\n"); in nfp_flower_wait_repr_reify()
158 nfp_flower_repr_netdev_open(struct nfp_app *app, struct nfp_repr *repr) in nfp_flower_repr_netdev_open() argument
172 nfp_flower_repr_netdev_stop(struct nfp_app *app, struct nfp_repr *repr) in nfp_flower_repr_netdev_stop() argument
180 nfp_flower_repr_netdev_init(struct nfp_app *app, struct net_device *netdev) in nfp_flower_repr_netdev_init() argument
188 nfp_flower_repr_netdev_clean(struct nfp_app *app, struct net_device *netdev) in nfp_flower_repr_netdev_clean() argument
199 nfp_flower_repr_netdev_preclean(struct nfp_app *app, struct net_device *netdev) in nfp_flower_repr_netdev_preclean() argument
202 struct nfp_flower_priv *priv = app->priv; in nfp_flower_repr_netdev_preclean()
209 nfp_warn(app->cpp, "Failed to notify firmware about repr destruction\n"); in nfp_flower_repr_netdev_preclean()
213 nfp_flower_wait_repr_reify(app, replies, 1); in nfp_flower_repr_netdev_preclean()
216 static void nfp_flower_sriov_disable(struct nfp_app *app) in nfp_flower_sriov_disable() argument
218 struct nfp_flower_priv *priv = app->priv; in nfp_flower_sriov_disable()
223 nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_VF); in nfp_flower_sriov_disable()
227 nfp_flower_spawn_vnic_reprs(struct nfp_app *app, in nfp_flower_spawn_vnic_reprs() argument
231 u8 nfp_pcie = nfp_cppcore_pcie_unit(app->pf->cpp); in nfp_flower_spawn_vnic_reprs()
232 struct nfp_flower_priv *priv = app->priv; in nfp_flower_spawn_vnic_reprs()
253 repr = nfp_repr_alloc(app); in nfp_flower_spawn_vnic_reprs()
271 port = nfp_port_alloc(app, port_type, repr); in nfp_flower_spawn_vnic_reprs()
284 app->pf->vf_cfg_mem + i * NFP_NET_CFG_BAR_SZ; in nfp_flower_spawn_vnic_reprs()
291 err = nfp_repr_init(app, repr, in nfp_flower_spawn_vnic_reprs()
300 nfp_info(app->cpp, "%s%d Representor(%s) created\n", in nfp_flower_spawn_vnic_reprs()
305 nfp_app_reprs_set(app, repr_type, reprs); in nfp_flower_spawn_vnic_reprs()
308 reify_cnt = nfp_flower_reprs_reify(app, repr_type, true); in nfp_flower_spawn_vnic_reprs()
311 nfp_warn(app->cpp, "Failed to notify firmware about repr creation\n"); in nfp_flower_spawn_vnic_reprs()
315 err = nfp_flower_wait_repr_reify(app, replies, reify_cnt); in nfp_flower_spawn_vnic_reprs()
321 reprs = nfp_app_reprs_set(app, repr_type, NULL); in nfp_flower_spawn_vnic_reprs()
323 nfp_reprs_clean_and_free(app, reprs); in nfp_flower_spawn_vnic_reprs()
327 static int nfp_flower_sriov_enable(struct nfp_app *app, int num_vfs) in nfp_flower_sriov_enable() argument
329 struct nfp_flower_priv *priv = app->priv; in nfp_flower_sriov_enable()
334 return nfp_flower_spawn_vnic_reprs(app, in nfp_flower_sriov_enable()
340 nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv) in nfp_flower_spawn_phy_reprs() argument
342 struct nfp_eth_table *eth_tbl = app->pf->eth_tbl; in nfp_flower_spawn_phy_reprs()
351 ctrl_skb = nfp_flower_cmsg_mac_repr_start(app, eth_tbl->count); in nfp_flower_spawn_phy_reprs()
367 repr = nfp_repr_alloc(app); in nfp_flower_spawn_phy_reprs()
382 port = nfp_port_alloc(app, NFP_PORT_PHYS_PORT, repr); in nfp_flower_spawn_phy_reprs()
388 err = nfp_port_init_phy_port(app->pf, app, port, i); in nfp_flower_spawn_phy_reprs()
396 nfp_net_get_mac_addr(app->pf, repr, port); in nfp_flower_spawn_phy_reprs()
399 err = nfp_repr_init(app, repr, in nfp_flower_spawn_phy_reprs()
413 nfp_info(app->cpp, "Phys Port %d Representor(%s) created\n", in nfp_flower_spawn_phy_reprs()
417 nfp_app_reprs_set(app, NFP_REPR_TYPE_PHYS_PORT, reprs); in nfp_flower_spawn_phy_reprs()
427 reify_cnt = nfp_flower_reprs_reify(app, NFP_REPR_TYPE_PHYS_PORT, true); in nfp_flower_spawn_phy_reprs()
430 nfp_warn(app->cpp, "Failed to notify firmware about repr creation\n"); in nfp_flower_spawn_phy_reprs()
434 err = nfp_flower_wait_repr_reify(app, replies, reify_cnt); in nfp_flower_spawn_phy_reprs()
438 nfp_ctrl_tx(app->ctrl, ctrl_skb); in nfp_flower_spawn_phy_reprs()
442 reprs = nfp_app_reprs_set(app, NFP_REPR_TYPE_PHYS_PORT, NULL); in nfp_flower_spawn_phy_reprs()
444 nfp_reprs_clean_and_free(app, reprs); in nfp_flower_spawn_phy_reprs()
450 static int nfp_flower_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, in nfp_flower_vnic_alloc() argument
454 nfp_warn(app->cpp, "FlowerNIC doesn't support more than one data vNIC\n"); in nfp_flower_vnic_alloc()
465 nn->port = nfp_port_alloc(app, NFP_PORT_INVALID, nn->dp.netdev); in nfp_flower_vnic_alloc()
469 static void nfp_flower_vnic_clean(struct nfp_app *app, struct nfp_net *nn) in nfp_flower_vnic_clean() argument
471 struct nfp_flower_priv *priv = app->priv; in nfp_flower_vnic_clean()
473 if (app->pf->num_vfs) in nfp_flower_vnic_clean()
474 nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_VF); in nfp_flower_vnic_clean()
475 nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PF); in nfp_flower_vnic_clean()
476 nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PHYS_PORT); in nfp_flower_vnic_clean()
481 static int nfp_flower_vnic_init(struct nfp_app *app, struct nfp_net *nn) in nfp_flower_vnic_init() argument
483 struct nfp_flower_priv *priv = app->priv; in nfp_flower_vnic_init()
488 err = nfp_flower_spawn_phy_reprs(app, app->priv); in nfp_flower_vnic_init()
492 err = nfp_flower_spawn_vnic_reprs(app, in nfp_flower_vnic_init()
498 if (app->pf->num_vfs) { in nfp_flower_vnic_init()
499 err = nfp_flower_spawn_vnic_reprs(app, in nfp_flower_vnic_init()
502 app->pf->num_vfs); in nfp_flower_vnic_init()
510 nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PF); in nfp_flower_vnic_init()
512 nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PHYS_PORT); in nfp_flower_vnic_init()
518 static int nfp_flower_init(struct nfp_app *app) in nfp_flower_init() argument
520 const struct nfp_pf *pf = app->pf; in nfp_flower_init()
526 nfp_warn(app->cpp, "FlowerNIC requires eth table\n"); in nfp_flower_init()
531 nfp_warn(app->cpp, "FlowerNIC requires mac_stats BAR\n"); in nfp_flower_init()
536 nfp_warn(app->cpp, "FlowerNIC requires vf_cfg BAR\n"); in nfp_flower_init()
540 version = nfp_rtsym_read_le(app->pf->rtbl, "hw_flower_version", &err); in nfp_flower_init()
542 nfp_warn(app->cpp, "FlowerNIC requires hw_flower_version memory symbol\n"); in nfp_flower_init()
548 nfp_warn(app->cpp, "FlowerNIC: unsupported firmware version\n"); in nfp_flower_init()
556 app->priv = app_priv; in nfp_flower_init()
557 app_priv->app = app; in nfp_flower_init()
566 err = nfp_flower_metadata_init(app); in nfp_flower_init()
571 features = nfp_rtsym_read_le(app->pf->rtbl, in nfp_flower_init()
579 err = nfp_rtsym_write_le(app->pf->rtbl, in nfp_flower_init()
585 nfp_warn(app->cpp, "LAG not supported by FW.\n"); in nfp_flower_init()
593 nfp_flower_metadata_cleanup(app); in nfp_flower_init()
595 vfree(app->priv); in nfp_flower_init()
599 static void nfp_flower_clean(struct nfp_app *app) in nfp_flower_clean() argument
601 struct nfp_flower_priv *app_priv = app->priv; in nfp_flower_clean()
610 nfp_flower_metadata_cleanup(app); in nfp_flower_clean()
611 vfree(app->priv); in nfp_flower_clean()
612 app->priv = NULL; in nfp_flower_clean()
627 nfp_flower_repr_change_mtu(struct nfp_app *app, struct net_device *netdev, in nfp_flower_repr_change_mtu() argument
630 struct nfp_flower_priv *app_priv = app->priv; in nfp_flower_repr_change_mtu()
639 nfp_err(app->cpp, "Physical port MTU setting not supported\n"); in nfp_flower_repr_change_mtu()
667 nfp_warn(app->cpp, "MTU change not verified with fw\n"); in nfp_flower_repr_change_mtu()
674 static int nfp_flower_start(struct nfp_app *app) in nfp_flower_start() argument
676 struct nfp_flower_priv *app_priv = app->priv; in nfp_flower_start()
689 return nfp_tunnel_config_start(app); in nfp_flower_start()
692 static void nfp_flower_stop(struct nfp_app *app) in nfp_flower_stop() argument
694 struct nfp_flower_priv *app_priv = app->priv; in nfp_flower_stop()
699 nfp_tunnel_config_stop(app); in nfp_flower_stop()