Skip to content

Commit ff4cf8e

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: sja1105: implement .devlink_info_get
Return the driver name and ASIC ID so that generic user space application are able to know they're looking at sja1105 devlink regions when pretty-printing them. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent bf425b8 commit ff4cf8e

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

drivers/net/dsa/sja1105/sja1105.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ int sja1105_devlink_param_get(struct dsa_switch *ds, u32 id,
255255
struct devlink_param_gset_ctx *ctx);
256256
int sja1105_devlink_param_set(struct dsa_switch *ds, u32 id,
257257
struct devlink_param_gset_ctx *ctx);
258+
int sja1105_devlink_info_get(struct dsa_switch *ds,
259+
struct devlink_info_req *req,
260+
struct netlink_ext_ack *extack);
258261

259262
/* From sja1105_spi.c */
260263
int sja1105_xfer_buf(const struct sja1105_private *priv,

drivers/net/dsa/sja1105/sja1105_devlink.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,23 @@ static void sja1105_teardown_devlink_params(struct dsa_switch *ds)
214214
ARRAY_SIZE(sja1105_devlink_params));
215215
}
216216

217+
int sja1105_devlink_info_get(struct dsa_switch *ds,
218+
struct devlink_info_req *req,
219+
struct netlink_ext_ack *extack)
220+
{
221+
struct sja1105_private *priv = ds->priv;
222+
int rc;
223+
224+
rc = devlink_info_driver_name_put(req, "sja1105");
225+
if (rc)
226+
return rc;
227+
228+
rc = devlink_info_version_fixed_put(req,
229+
DEVLINK_INFO_VERSION_GENERIC_ASIC_ID,
230+
priv->info->name);
231+
return rc;
232+
}
233+
217234
int sja1105_devlink_setup(struct dsa_switch *ds)
218235
{
219236
int rc;

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3316,6 +3316,7 @@ static const struct dsa_switch_ops sja1105_switch_ops = {
33163316
.crosschip_bridge_leave = sja1105_crosschip_bridge_leave,
33173317
.devlink_param_get = sja1105_devlink_param_get,
33183318
.devlink_param_set = sja1105_devlink_param_set,
3319+
.devlink_info_get = sja1105_devlink_info_get,
33193320
};
33203321

33213322
static const struct of_device_id sja1105_dt_ids[];

0 commit comments

Comments
 (0)