All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: hellcreek: Report switch name and ID
@ 2021-03-20 11:27 Kurt Kanzenbach
  2021-03-20 14:22 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Kurt Kanzenbach @ 2021-03-20 11:27 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean
  Cc: David S. Miller, Jakub Kicinski, netdev, Kurt Kanzenbach

Report the driver name, ASIC ID and the switch name via devlink. This is a
useful information for user space tooling.

Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
---
 drivers/net/dsa/hirschmann/hellcreek.c         | 18 ++++++++++++++++++
 .../linux/platform_data/hirschmann-hellcreek.h |  1 +
 2 files changed, 19 insertions(+)

diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
index 6cba02307bda..dd4d22a607d6 100644
--- a/drivers/net/dsa/hirschmann/hellcreek.c
+++ b/drivers/net/dsa/hirschmann/hellcreek.c
@@ -1086,6 +1086,22 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 	return ret;
 }
 
+static int hellcreek_devlink_info_get(struct dsa_switch *ds,
+				      struct devlink_info_req *req,
+				      struct netlink_ext_ack *extack)
+{
+	struct hellcreek *hellcreek = ds->priv;
+	int ret;
+
+	ret = devlink_info_driver_name_put(req, "hellcreek");
+	if (ret)
+		return ret;
+
+	return devlink_info_version_fixed_put(req,
+					      DEVLINK_INFO_VERSION_GENERIC_ASIC_ID,
+					      hellcreek->pdata->name);
+}
+
 static u64 hellcreek_devlink_vlan_table_get(void *priv)
 {
 	struct hellcreek *hellcreek = priv;
@@ -1796,6 +1812,7 @@ static int hellcreek_port_setup_tc(struct dsa_switch *ds, int port,
 }
 
 static const struct dsa_switch_ops hellcreek_ds_ops = {
+	.devlink_info_get      = hellcreek_devlink_info_get,
 	.get_ethtool_stats     = hellcreek_get_ethtool_stats,
 	.get_sset_count	       = hellcreek_get_sset_count,
 	.get_strings	       = hellcreek_get_strings,
@@ -1973,6 +1990,7 @@ static int hellcreek_remove(struct platform_device *pdev)
 }
 
 static const struct hellcreek_platform_data de1soc_r1_pdata = {
+	.name		 = "Hellcreek r4c30",
 	.num_ports	 = 4,
 	.is_100_mbits	 = 1,
 	.qbv_support	 = 1,
diff --git a/include/linux/platform_data/hirschmann-hellcreek.h b/include/linux/platform_data/hirschmann-hellcreek.h
index 388846766bb2..6a000df5541f 100644
--- a/include/linux/platform_data/hirschmann-hellcreek.h
+++ b/include/linux/platform_data/hirschmann-hellcreek.h
@@ -12,6 +12,7 @@
 #include <linux/types.h>
 
 struct hellcreek_platform_data {
+	const char *name;	/* Switch name */
 	int num_ports;		/* Amount of switch ports */
 	int is_100_mbits;	/* Is it configured to 100 or 1000 mbit/s */
 	int qbv_support;	/* Qbv support on front TSN ports */
-- 
2.31.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: hellcreek: Report switch name and ID
  2021-03-20 11:27 [PATCH net-next] net: dsa: hellcreek: Report switch name and ID Kurt Kanzenbach
@ 2021-03-20 14:22 ` Andrew Lunn
  2021-03-22 18:41   ` Kurt Kanzenbach
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2021-03-20 14:22 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Jakub Kicinski, netdev

> +static int hellcreek_devlink_info_get(struct dsa_switch *ds,
> +				      struct devlink_info_req *req,
> +				      struct netlink_ext_ack *extack)
> +{
> +	struct hellcreek *hellcreek = ds->priv;
> +	int ret;
> +
> +	ret = devlink_info_driver_name_put(req, "hellcreek");
> +	if (ret)
> +		return ret;
> +
> +	return devlink_info_version_fixed_put(req,
> +					      DEVLINK_INFO_VERSION_GENERIC_ASIC_ID,
> +					      hellcreek->pdata->name);

>  static const struct hellcreek_platform_data de1soc_r1_pdata = {
> +	.name		 = "Hellcreek r4c30",

Hi Kurt

The two other DSA drivers which implement this keep the
DEVLINK_INFO_VERSION_GENERIC_ASIC_ID just the model name, mv88e6390,
SJA1105E for example. You have hellcreek in the driver name, so i
don't see a need to repeat it.

      Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: hellcreek: Report switch name and ID
  2021-03-20 14:22 ` Andrew Lunn
@ 2021-03-22 18:41   ` Kurt Kanzenbach
  0 siblings, 0 replies; 3+ messages in thread
From: Kurt Kanzenbach @ 2021-03-22 18:41 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Jakub Kicinski, netdev

[-- Attachment #1: Type: text/plain, Size: 884 bytes --]

On Sat Mar 20 2021, Andrew Lunn wrote:
>> +static int hellcreek_devlink_info_get(struct dsa_switch *ds,
>> +				      struct devlink_info_req *req,
>> +				      struct netlink_ext_ack *extack)
>> +{
>> +	struct hellcreek *hellcreek = ds->priv;
>> +	int ret;
>> +
>> +	ret = devlink_info_driver_name_put(req, "hellcreek");
>> +	if (ret)
>> +		return ret;
>> +
>> +	return devlink_info_version_fixed_put(req,
>> +					      DEVLINK_INFO_VERSION_GENERIC_ASIC_ID,
>> +					      hellcreek->pdata->name);
>
>>  static const struct hellcreek_platform_data de1soc_r1_pdata = {
>> +	.name		 = "Hellcreek r4c30",
>
> Hi Kurt
>
> The two other DSA drivers which implement this keep the
> DEVLINK_INFO_VERSION_GENERIC_ASIC_ID just the model name, mv88e6390,
> SJA1105E for example. You have hellcreek in the driver name, so i
> don't see a need to repeat it.

I see, makes sense.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 865 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-22 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-20 11:27 [PATCH net-next] net: dsa: hellcreek: Report switch name and ID Kurt Kanzenbach
2021-03-20 14:22 ` Andrew Lunn
2021-03-22 18:41   ` Kurt Kanzenbach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.