diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-11-21 14:55:41 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-11-23 05:41:46 +0100 |
commit | 5cf2c75b5b91bcf81d61b2d2ea1c71363bcacf89 (patch) | |
tree | 1bafe3106befdca7f83071c94d45928c29c26509 /net/dsa/dsa.c | |
parent | net: dsa: modularize DSA_TAG_PROTO_NONE (diff) | |
download | linux-5cf2c75b5b91bcf81d61b2d2ea1c71363bcacf89.tar.xz linux-5cf2c75b5b91bcf81d61b2d2ea1c71363bcacf89.zip |
net: dsa: move bulk of devlink code to devlink.{c,h}
dsa.c and dsa2.c are bloated with too much off-topic code. Identify all
code related to devlink and move it to a new devlink.c file.
Steer clear of the dsa_priv.h dumping ground antipattern and create a
dedicated devlink.h for it, which will be included only by the C files
which need it. Usage of dsa_priv.h will be minimized in later patches.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r-- | net/dsa/dsa.c | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index e609d64a2216..842a1f2488b2 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -344,113 +344,6 @@ void dsa_flush_workqueue(void) } EXPORT_SYMBOL_GPL(dsa_flush_workqueue); -int dsa_devlink_param_get(struct devlink *dl, u32 id, - struct devlink_param_gset_ctx *ctx) -{ - struct dsa_switch *ds = dsa_devlink_to_ds(dl); - - if (!ds->ops->devlink_param_get) - return -EOPNOTSUPP; - - return ds->ops->devlink_param_get(ds, id, ctx); -} -EXPORT_SYMBOL_GPL(dsa_devlink_param_get); - -int dsa_devlink_param_set(struct devlink *dl, u32 id, - struct devlink_param_gset_ctx *ctx) -{ - struct dsa_switch *ds = dsa_devlink_to_ds(dl); - - if (!ds->ops->devlink_param_set) - return -EOPNOTSUPP; - - return ds->ops->devlink_param_set(ds, id, ctx); -} -EXPORT_SYMBOL_GPL(dsa_devlink_param_set); - -int dsa_devlink_params_register(struct dsa_switch *ds, - const struct devlink_param *params, - size_t params_count) -{ - return devlink_params_register(ds->devlink, params, params_count); -} -EXPORT_SYMBOL_GPL(dsa_devlink_params_register); - -void dsa_devlink_params_unregister(struct dsa_switch *ds, - const struct devlink_param *params, - size_t params_count) -{ - devlink_params_unregister(ds->devlink, params, params_count); -} -EXPORT_SYMBOL_GPL(dsa_devlink_params_unregister); - -int dsa_devlink_resource_register(struct dsa_switch *ds, - const char *resource_name, - u64 resource_size, - u64 resource_id, - u64 parent_resource_id, - const struct devlink_resource_size_params *size_params) -{ - return devlink_resource_register(ds->devlink, resource_name, - resource_size, resource_id, - parent_resource_id, - size_params); -} -EXPORT_SYMBOL_GPL(dsa_devlink_resource_register); - -void dsa_devlink_resources_unregister(struct dsa_switch *ds) -{ - devlink_resources_unregister(ds->devlink); -} -EXPORT_SYMBOL_GPL(dsa_devlink_resources_unregister); - -void dsa_devlink_resource_occ_get_register(struct dsa_switch *ds, - u64 resource_id, - devlink_resource_occ_get_t *occ_get, - void *occ_get_priv) -{ - return devlink_resource_occ_get_register(ds->devlink, resource_id, - occ_get, occ_get_priv); -} -EXPORT_SYMBOL_GPL(dsa_devlink_resource_occ_get_register); - -void dsa_devlink_resource_occ_get_unregister(struct dsa_switch *ds, - u64 resource_id) -{ - devlink_resource_occ_get_unregister(ds->devlink, resource_id); -} -EXPORT_SYMBOL_GPL(dsa_devlink_resource_occ_get_unregister); - -struct devlink_region * -dsa_devlink_region_create(struct dsa_switch *ds, - const struct devlink_region_ops *ops, - u32 region_max_snapshots, u64 region_size) -{ - return devlink_region_create(ds->devlink, ops, region_max_snapshots, - region_size); -} -EXPORT_SYMBOL_GPL(dsa_devlink_region_create); - -struct devlink_region * -dsa_devlink_port_region_create(struct dsa_switch *ds, - int port, - const struct devlink_port_region_ops *ops, - u32 region_max_snapshots, u64 region_size) -{ - struct dsa_port *dp = dsa_to_port(ds, port); - - return devlink_port_region_create(&dp->devlink_port, ops, - region_max_snapshots, - region_size); -} -EXPORT_SYMBOL_GPL(dsa_devlink_port_region_create); - -void dsa_devlink_region_destroy(struct devlink_region *region) -{ - devlink_region_destroy(region); -} -EXPORT_SYMBOL_GPL(dsa_devlink_region_destroy); - struct dsa_port *dsa_port_from_netdev(struct net_device *netdev) { if (!netdev || !dsa_slave_dev_check(netdev)) |