Lines Matching refs:nsim_dev_port
392 struct nsim_dev_port *nsim_dev_port) in nsim_dev_port_debugfs_init() argument
395 unsigned int port_index = nsim_dev_port->port_index; in nsim_dev_port_debugfs_init()
400 nsim_dev_port->ddir = debugfs_create_dir(port_ddir_name, in nsim_dev_port_debugfs_init()
402 if (IS_ERR(nsim_dev_port->ddir)) in nsim_dev_port_debugfs_init()
403 return PTR_ERR(nsim_dev_port->ddir); in nsim_dev_port_debugfs_init()
406 if (nsim_dev_port_is_vf(nsim_dev_port)) { in nsim_dev_port_debugfs_init()
409 debugfs_create_u16("tx_share", 0400, nsim_dev_port->ddir, in nsim_dev_port_debugfs_init()
411 debugfs_create_u16("tx_max", 0400, nsim_dev_port->ddir, in nsim_dev_port_debugfs_init()
413 nsim_dev_port->rate_parent = debugfs_create_file("rate_parent", in nsim_dev_port_debugfs_init()
415 nsim_dev_port->ddir, in nsim_dev_port_debugfs_init()
416 &nsim_dev_port->parent_name, in nsim_dev_port_debugfs_init()
419 debugfs_create_symlink("dev", nsim_dev_port->ddir, dev_link_name); in nsim_dev_port_debugfs_init()
424 static void nsim_dev_port_debugfs_exit(struct nsim_dev_port *nsim_dev_port) in nsim_dev_port_debugfs_exit() argument
426 debugfs_remove_recursive(nsim_dev_port->ddir); in nsim_dev_port_debugfs_exit()
580 static void __nsim_dev_port_del(struct nsim_dev_port *nsim_dev_port);
586 struct nsim_dev_port *nsim_dev_port, *tmp; in nsim_esw_legacy_enable() local
589 list_for_each_entry_safe(nsim_dev_port, tmp, &nsim_dev->port_list, list) in nsim_esw_legacy_enable()
590 if (nsim_dev_port_is_vf(nsim_dev_port)) in nsim_esw_legacy_enable()
591 __nsim_dev_port_del(nsim_dev_port); in nsim_esw_legacy_enable()
599 struct nsim_dev_port *nsim_dev_port, *tmp; in nsim_esw_switchdev_enable() local
614 list_for_each_entry_safe(nsim_dev_port, tmp, &nsim_dev->port_list, list) in nsim_esw_switchdev_enable()
615 if (nsim_dev_port_is_vf(nsim_dev_port)) in nsim_esw_switchdev_enable()
616 __nsim_dev_port_del(nsim_dev_port); in nsim_esw_switchdev_enable()
782 static void nsim_dev_trap_report(struct nsim_dev_port *nsim_dev_port) in nsim_dev_trap_report() argument
784 struct nsim_dev *nsim_dev = nsim_dev_port->ns->nsim_dev; in nsim_dev_trap_report()
808 skb->dev = nsim_dev_port->ns->netdev; in nsim_dev_trap_report()
819 &nsim_dev_port->devlink_port, fa_cookie); in nsim_dev_trap_report()
831 struct nsim_dev_port *nsim_dev_port; in nsim_dev_trap_report_work() local
847 list_for_each_entry(nsim_dev_port, &nsim_dev->port_list, list) { in nsim_dev_trap_report_work()
848 if (!netif_running(nsim_dev_port->ns->netdev)) in nsim_dev_trap_report_work()
851 nsim_dev_trap_report(nsim_dev_port); in nsim_dev_trap_report_work()
1178 struct nsim_dev_port *nsim_dev_port = priv; in nsim_leaf_tx_share_set() local
1179 struct nsim_dev *nsim_dev = nsim_dev_port->ns->nsim_dev; in nsim_leaf_tx_share_set()
1180 int vf_id = nsim_dev_port_index_to_vf_index(nsim_dev_port->port_index); in nsim_leaf_tx_share_set()
1194 struct nsim_dev_port *nsim_dev_port = priv; in nsim_leaf_tx_max_set() local
1195 struct nsim_dev *nsim_dev = nsim_dev_port->ns->nsim_dev; in nsim_leaf_tx_max_set()
1196 int vf_id = nsim_dev_port_index_to_vf_index(nsim_dev_port->port_index); in nsim_leaf_tx_max_set()
1287 struct nsim_dev_port *nsim_dev_port = priv_child; in nsim_rate_leaf_parent_set() local
1290 nsim_dev_port->parent_name = parent->name; in nsim_rate_leaf_parent_set()
1292 nsim_dev_port->parent_name = NULL; in nsim_rate_leaf_parent_set()
1359 struct nsim_dev_port *nsim_dev_port; in __nsim_dev_port_add() local
1366 nsim_dev_port = kzalloc(sizeof(*nsim_dev_port), GFP_KERNEL); in __nsim_dev_port_add()
1367 if (!nsim_dev_port) in __nsim_dev_port_add()
1369 nsim_dev_port->port_index = nsim_dev_port_index(type, port_index); in __nsim_dev_port_add()
1370 nsim_dev_port->port_type = type; in __nsim_dev_port_add()
1372 devlink_port = &nsim_dev_port->devlink_port; in __nsim_dev_port_add()
1373 if (nsim_dev_port_is_pf(nsim_dev_port)) { in __nsim_dev_port_add()
1385 nsim_dev_port->port_index); in __nsim_dev_port_add()
1389 err = nsim_dev_port_debugfs_init(nsim_dev, nsim_dev_port); in __nsim_dev_port_add()
1393 nsim_dev_port->ns = nsim_create(nsim_dev, nsim_dev_port); in __nsim_dev_port_add()
1394 if (IS_ERR(nsim_dev_port->ns)) { in __nsim_dev_port_add()
1395 err = PTR_ERR(nsim_dev_port->ns); in __nsim_dev_port_add()
1399 if (nsim_dev_port_is_vf(nsim_dev_port)) { in __nsim_dev_port_add()
1400 err = devl_rate_leaf_create(&nsim_dev_port->devlink_port, in __nsim_dev_port_add()
1401 nsim_dev_port, NULL); in __nsim_dev_port_add()
1406 list_add(&nsim_dev_port->list, &nsim_dev->port_list); in __nsim_dev_port_add()
1411 nsim_destroy(nsim_dev_port->ns); in __nsim_dev_port_add()
1413 nsim_dev_port_debugfs_exit(nsim_dev_port); in __nsim_dev_port_add()
1417 kfree(nsim_dev_port); in __nsim_dev_port_add()
1421 static void __nsim_dev_port_del(struct nsim_dev_port *nsim_dev_port) in __nsim_dev_port_del() argument
1423 struct devlink_port *devlink_port = &nsim_dev_port->devlink_port; in __nsim_dev_port_del()
1425 list_del(&nsim_dev_port->list); in __nsim_dev_port_del()
1426 if (nsim_dev_port_is_vf(nsim_dev_port)) in __nsim_dev_port_del()
1427 devl_rate_leaf_destroy(&nsim_dev_port->devlink_port); in __nsim_dev_port_del()
1428 nsim_destroy(nsim_dev_port->ns); in __nsim_dev_port_del()
1429 nsim_dev_port_debugfs_exit(nsim_dev_port); in __nsim_dev_port_del()
1431 kfree(nsim_dev_port); in __nsim_dev_port_del()
1436 struct nsim_dev_port *nsim_dev_port, *tmp; in nsim_dev_port_del_all() local
1438 list_for_each_entry_safe(nsim_dev_port, tmp, in nsim_dev_port_del_all()
1440 __nsim_dev_port_del(nsim_dev_port); in nsim_dev_port_del_all()
1691 static struct nsim_dev_port *
1695 struct nsim_dev_port *nsim_dev_port; in __nsim_dev_port_lookup() local
1698 list_for_each_entry(nsim_dev_port, &nsim_dev->port_list, list) in __nsim_dev_port_lookup()
1699 if (nsim_dev_port->port_index == port_index) in __nsim_dev_port_lookup()
1700 return nsim_dev_port; in __nsim_dev_port_lookup()
1723 struct nsim_dev_port *nsim_dev_port; in nsim_drv_port_del() local
1727 nsim_dev_port = __nsim_dev_port_lookup(nsim_dev, type, port_index); in nsim_drv_port_del()
1728 if (!nsim_dev_port) in nsim_drv_port_del()
1731 __nsim_dev_port_del(nsim_dev_port); in nsim_drv_port_del()