linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] can: etas_es58x: es58x_init_netdev: populate net_device::dev_port
@ 2021-10-26 18:05 Vincent Mailhol
  2021-10-29 11:18 ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Mailhol @ 2021-10-26 18:05 UTC (permalink / raw)
  To: Marc Kleine-Budde, linux-can, Lukas Magel
  Cc: netdev, linux-kernel, Vincent Mailhol

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

Suggested-by: Lukas Magel <lukas.magel@escrypt.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 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 96a13c770e4a..403de7e9d084 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -2096,6 +2096,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.32.0


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

* Re: [PATCH v1] can: etas_es58x: es58x_init_netdev: populate net_device::dev_port
  2021-10-26 18:05 [PATCH v1] can: etas_es58x: es58x_init_netdev: populate net_device::dev_port Vincent Mailhol
@ 2021-10-29 11:18 ` Marc Kleine-Budde
  2021-12-13 16:10   ` [RESEND PATCH " Vincent Mailhol
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-10-29 11:18 UTC (permalink / raw)
  To: Vincent Mailhol; +Cc: linux-can, Lukas Magel, netdev, linux-kernel

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

On 27.10.2021 03:05:53, Vincent Mailhol wrote:
> 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
> 
> Suggested-by: Lukas Magel <lukas.magel@escrypt.com>
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>

Applied to linux-can-next/testing.

Thanks,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

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

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

* [RESEND PATCH v1] can: etas_es58x: es58x_init_netdev: populate net_device::dev_port
  2021-10-29 11:18 ` Marc Kleine-Budde
@ 2021-12-13 16:10   ` Vincent Mailhol
  0 siblings, 0 replies; 3+ messages in thread
From: Vincent Mailhol @ 2021-12-13 16:10 UTC (permalink / raw)
  To: Marc Kleine-Budde, linux-can
  Cc: netdev, linux-kernel, Vincent Mailhol, Lukas Magel

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

Suggested-by: Lukas Magel <lukas.magel@escrypt.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
Hi Marc,

At one point, this patch was applied to linux-can-next/testing but was
then removed. I guess it just went off your radar. Resending it :)


Yours sincerely,
Vincent Mailhol

---
 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 96a13c770e4a..403de7e9d084 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -2096,6 +2096,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.32.0


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

end of thread, other threads:[~2021-12-13 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 18:05 [PATCH v1] can: etas_es58x: es58x_init_netdev: populate net_device::dev_port Vincent Mailhol
2021-10-29 11:18 ` Marc Kleine-Budde
2021-12-13 16:10   ` [RESEND PATCH " Vincent Mailhol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).