Commit 0f06b855 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

net: dsa: wire up devlink info get

Allow the DSA drivers to implement the devlink call to get info info,
e.g. driver name, firmware version, ASIC ID, etc.

v2:
Combine declaration and the assignment on a single line.
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bfb25542
...@@ -612,11 +612,14 @@ struct dsa_switch_ops { ...@@ -612,11 +612,14 @@ struct dsa_switch_ops {
bool (*port_rxtstamp)(struct dsa_switch *ds, int port, bool (*port_rxtstamp)(struct dsa_switch *ds, int port,
struct sk_buff *skb, unsigned int type); struct sk_buff *skb, unsigned int type);
/* Devlink parameters */ /* Devlink parameters, etc */
int (*devlink_param_get)(struct dsa_switch *ds, u32 id, int (*devlink_param_get)(struct dsa_switch *ds, u32 id,
struct devlink_param_gset_ctx *ctx); struct devlink_param_gset_ctx *ctx);
int (*devlink_param_set)(struct dsa_switch *ds, u32 id, int (*devlink_param_set)(struct dsa_switch *ds, u32 id,
struct devlink_param_gset_ctx *ctx); struct devlink_param_gset_ctx *ctx);
int (*devlink_info_get)(struct dsa_switch *ds,
struct devlink_info_req *req,
struct netlink_ext_ack *extack);
/* /*
* MTU change functionality. Switches can also adjust their MRU through * MTU change functionality. Switches can also adjust their MRU through
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
static DEFINE_MUTEX(dsa2_mutex); static DEFINE_MUTEX(dsa2_mutex);
LIST_HEAD(dsa_tree_list); LIST_HEAD(dsa_tree_list);
static const struct devlink_ops dsa_devlink_ops = {
};
struct dsa_switch *dsa_switch_find(int tree_index, int sw_index) struct dsa_switch *dsa_switch_find(int tree_index, int sw_index)
{ {
struct dsa_switch_tree *dst; struct dsa_switch_tree *dst;
...@@ -382,6 +379,22 @@ static void dsa_port_teardown(struct dsa_port *dp) ...@@ -382,6 +379,22 @@ static void dsa_port_teardown(struct dsa_port *dp)
dp->setup = false; dp->setup = false;
} }
static int dsa_devlink_info_get(struct devlink *dl,
struct devlink_info_req *req,
struct netlink_ext_ack *extack)
{
struct dsa_switch *ds = dsa_devlink_to_ds(dl);
if (ds->ops->devlink_info_get)
return ds->ops->devlink_info_get(ds, req, extack);
return -EOPNOTSUPP;
}
static const struct devlink_ops dsa_devlink_ops = {
.info_get = dsa_devlink_info_get,
};
static int dsa_switch_setup(struct dsa_switch *ds) static int dsa_switch_setup(struct dsa_switch *ds)
{ {
struct dsa_devlink_priv *dl_priv; struct dsa_devlink_priv *dl_priv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment