[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220105144402.1174191-7-mkl@pengutronix.de>
Date: Wed, 5 Jan 2022 15:43:53 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, linux-can@...r.kernel.org,
kernel@...gutronix.de,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Lukas Magel <lukas.magel@...rypt.com>,
Marc Kleine-Budde <mkl@...gutronix.de>
Subject: [PATCH net-next 06/15] can: etas_es58x: es58x_init_netdev: populate net_device::dev_port
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
The field dev_port of struct net_device indicates the port number of a
network device [1]. This patch populates this field.
This field can be helpful to distinguish between the two network
interfaces of a dual channel device (i.e. ES581.4 or ES582.1). Indeed,
at the moment, all the network interfaces of a same device share the
same static udev attributes c.f. output of:
| udevadm info --attribute-walk /sys/class/net/canX
The dev_port attribute can then be used to write some udev rules to,
for example, assign a permanent name to each network interface based
on the serial/dev_port pair (which is convenient when you have a test
bench with several CAN devices connected simultaneously and wish to
keep consistent interface names upon reboot).
[1] https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net
Link: https://lore.kernel.org/all/20211026180553.1953189-1-mailhol.vincent@wanadoo.fr
Suggested-by: Lukas Magel <lukas.magel@...rypt.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index 24627ab14626..8508a73d648e 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -2094,6 +2094,7 @@ static int es58x_init_netdev(struct es58x_device *es58x_dev, int channel_idx)
netdev->netdev_ops = &es58x_netdev_ops;
netdev->flags |= IFF_ECHO; /* We support local echo */
+ netdev->dev_port = channel_idx;
ret = register_candev(netdev);
if (ret)
--
2.34.1
Powered by blists - more mailing lists