All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers
@ 2018-08-28 21:01 Arseny Maslennikov
  2018-08-28 21:01 ` [PATCH 1/3] IB/ipoib: Use dev_port to expose network interface " Arseny Maslennikov
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Arseny Maslennikov @ 2018-08-28 21:01 UTC (permalink / raw)
  To: linux-rdma; +Cc: Arseny Maslennikov, Doug Ledford, Jason Gunthorpe, netdev

Pre-3.15 userspace had trouble distinguishing different ports
of a NIC on a single PCI bus/device/function. To solve this,
a sysfs field `dev_port' was introduced quite a while ago
(commit v3.14-rc3-739-g3f85944fe207), and some relevant device
drivers were fixed to use it, but not in case of IPoIB.

The convention for some reason never got documented in the kernel, but
was immediately adopted by userspace (notably udev[1][2], biosdevname[3])

3/3 documents the sysfs field — that's why I'm CC-ing netdev.

This series was tested on and applies to 4.19-rc1.

[1] https://lists.freedesktop.org/archives/systemd-devel/2014-June/020788.html
[2] https://lists.freedesktop.org/archives/systemd-devel/2014-July/020804.html
[3] https://github.com/CloudAutomationNTools/biosdevname/blob/c795d51dd93a5309652f0d635f12a3ecfabfaa72/src/eths.c#L38

Arseny Maslennikov (3):
  IB/ipoib: Use dev_port to expose network interface port numbers
  IB/ipoib: Stop using dev_id to expose port numbers
  Documentation/ABI: document /sys/class/net/*/dev_port

 Documentation/ABI/testing/sysfs-class-net | 10 ++++++++++
 drivers/infiniband/ulp/ipoib/ipoib_main.c |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

-- 
2.18.0

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

* [PATCH 1/3] IB/ipoib: Use dev_port to expose network interface port numbers
  2018-08-28 21:01 [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers Arseny Maslennikov
@ 2018-08-28 21:01 ` Arseny Maslennikov
  2018-08-28 21:01 ` [PATCH 2/3] IB/ipoib: Stop using dev_id to expose " Arseny Maslennikov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Arseny Maslennikov @ 2018-08-28 21:01 UTC (permalink / raw)
  To: linux-rdma; +Cc: Arseny Maslennikov, Doug Ledford, Jason Gunthorpe, netdev

Some InfiniBand network devices have multiple ports on the same PCI
function. This initializes the `dev_port' sysfs field of those
network interfaces with their port number.

The use of `dev_id' was considered correct until Linux 3.15,
when another field, `dev_port', was defined for this particular
purpose and `dev_id' was reserved for distinguishing stacked ifaces
(e.g: VLANs) with the same hardware address as their parent device.

Similar fixes to net/mlx4_en and many other drivers, which started
exporting this information through `dev_id' before 3.15, were accepted
into the kernel 4 years ago.
See 76a066f2a2a0268b565459c417b59724b5a3197b, commit message:
`net/mlx4_en: Expose port number through sysfs'.

Signed-off-by: Arseny Maslennikov <ar@cs.msu.ru>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index e3d28f9ad9c0..fcd69273de91 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1881,6 +1881,7 @@ static int ipoib_parent_init(struct net_device *ndev)
 
 	SET_NETDEV_DEV(priv->dev, priv->ca->dev.parent);
 	priv->dev->dev_id = priv->port - 1;
+	priv->dev->dev_port = priv->port - 1;
 
 	return 0;
 }
-- 
2.18.0

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

* [PATCH 2/3] IB/ipoib: Stop using dev_id to expose port numbers
  2018-08-28 21:01 [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers Arseny Maslennikov
  2018-08-28 21:01 ` [PATCH 1/3] IB/ipoib: Use dev_port to expose network interface " Arseny Maslennikov
@ 2018-08-28 21:01 ` Arseny Maslennikov
  2018-08-29  9:44   ` Sergei Shtylyov
  2018-08-28 21:01 ` [PATCH 3/3] Documentation/ABI: document /sys/class/net/*/dev_port Arseny Maslennikov
  2018-08-30  5:43 ` [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers Leon Romanovsky
  3 siblings, 1 reply; 8+ messages in thread
From: Arseny Maslennikov @ 2018-08-28 21:01 UTC (permalink / raw)
  To: linux-rdma; +Cc: Arseny Maslennikov, Doug Ledford, Jason Gunthorpe, netdev

Some InfiniBand network devices have multiple ports on the same PCI
function. Prior to this the kernel erroneously used the `dev_id' sysfs
field of those network interfaces to convey the port number to userspace.

`dev_id' is currently reserved for distinguishing stacked ifaces
(e.g: VLANs) with the same hardware address as their parent device.

Similar fixes to net/mlx4_en and many other drivers, which started
exporting this information through `dev_id' before 3.15, were accepted
into the kernel 4 years ago.
See 76a066f2a2a0268b565459c417b59724b5a3197b, commit message:
`net/mlx4_en: Expose port number through sysfs'.

This commit is separated from the previous one since we may wish to
preserve backwards compatibility with userspace being already dependent
on `dev_id' being different.

Signed-off-by: Arseny Maslennikov <ar@cs.msu.ru>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index fcd69273de91..ba16a63ee303 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1880,7 +1880,6 @@ static int ipoib_parent_init(struct net_device *ndev)
 	       sizeof(union ib_gid));
 
 	SET_NETDEV_DEV(priv->dev, priv->ca->dev.parent);
-	priv->dev->dev_id = priv->port - 1;
 	priv->dev->dev_port = priv->port - 1;
 
 	return 0;
-- 
2.18.0

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

* [PATCH 3/3] Documentation/ABI: document /sys/class/net/*/dev_port
  2018-08-28 21:01 [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers Arseny Maslennikov
  2018-08-28 21:01 ` [PATCH 1/3] IB/ipoib: Use dev_port to expose network interface " Arseny Maslennikov
  2018-08-28 21:01 ` [PATCH 2/3] IB/ipoib: Stop using dev_id to expose " Arseny Maslennikov
@ 2018-08-28 21:01 ` Arseny Maslennikov
  2018-08-30  5:43 ` [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers Leon Romanovsky
  3 siblings, 0 replies; 8+ messages in thread
From: Arseny Maslennikov @ 2018-08-28 21:01 UTC (permalink / raw)
  To: linux-rdma; +Cc: Arseny Maslennikov, Doug Ledford, Jason Gunthorpe, netdev

The sysfs field was introduced 4 years ago along with fixes to various
drivers that erroneously used `dev_id' for that purpose, but it was not
properly documented anywhere.
See commit v3.14-rc3-739-g3f85944fe207.

Signed-off-by: Arseny Maslennikov <ar@cs.msu.ru>
---
 Documentation/ABI/testing/sysfs-class-net | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-net b/Documentation/ABI/testing/sysfs-class-net
index 2f1788111cd9..1593d8997ade 100644
--- a/Documentation/ABI/testing/sysfs-class-net
+++ b/Documentation/ABI/testing/sysfs-class-net
@@ -91,6 +91,16 @@ Description:
 		stacked (e.g: VLAN interfaces) but still have the same MAC
 		address as their parent device.
 
+What:		/sys/class/net/<iface>/dev_port
+Date:		February 2014
+KernelVersion:	3.15
+Contact:	netdev@vger.kernel.org
+Description:
+		Indicates the port number of this network device, formatted
+		as a decimal value. Some NICs have multiple independent ports
+		on the same PCI bus, device and function. This field allows
+		userspace to distinguish the respective interfaces.
+
 What:		/sys/class/net/<iface>/dormant
 Date:		March 2006
 KernelVersion:	2.6.17
-- 
2.18.0

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

* Re: [PATCH 2/3] IB/ipoib: Stop using dev_id to expose port numbers
  2018-08-28 21:01 ` [PATCH 2/3] IB/ipoib: Stop using dev_id to expose " Arseny Maslennikov
@ 2018-08-29  9:44   ` Sergei Shtylyov
  0 siblings, 0 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2018-08-29  9:44 UTC (permalink / raw)
  To: Arseny Maslennikov, linux-rdma; +Cc: Doug Ledford, Jason Gunthorpe, netdev

Hello!

On 8/29/2018 12:01 AM, Arseny Maslennikov wrote:

> Some InfiniBand network devices have multiple ports on the same PCI
> function. Prior to this the kernel erroneously used the `dev_id' sysfs
> field of those network interfaces to convey the port number to userspace.
> 
> `dev_id' is currently reserved for distinguishing stacked ifaces
> (e.g: VLANs) with the same hardware address as their parent device.
> 
> Similar fixes to net/mlx4_en and many other drivers, which started
> exporting this information through `dev_id' before 3.15, were accepted
> into the kernel 4 years ago.
> See 76a066f2a2a0268b565459c417b59724b5a3197b, commit message:
> `net/mlx4_en: Expose port number through sysfs'.

    See commit 76a066f2a2a0 ("net/mlx4_en: Expose port number through sysfs").
> This commit is separated from the previous one since we may wish to
> preserve backwards compatibility with userspace being already dependent
> on `dev_id' being different.
> 
> Signed-off-by: Arseny Maslennikov <ar@cs.msu.ru>
[...]

MBR, Sergei

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

* Re: [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers
  2018-08-28 21:01 [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers Arseny Maslennikov
                   ` (2 preceding siblings ...)
  2018-08-28 21:01 ` [PATCH 3/3] Documentation/ABI: document /sys/class/net/*/dev_port Arseny Maslennikov
@ 2018-08-30  5:43 ` Leon Romanovsky
  2018-08-30  8:42   ` Arseny Maslennikov
  3 siblings, 1 reply; 8+ messages in thread
From: Leon Romanovsky @ 2018-08-30  5:43 UTC (permalink / raw)
  To: Arseny Maslennikov; +Cc: linux-rdma, Doug Ledford, Jason Gunthorpe, netdev

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

On Wed, Aug 29, 2018 at 12:01:14AM +0300, Arseny Maslennikov wrote:
> Pre-3.15 userspace had trouble distinguishing different ports
> of a NIC on a single PCI bus/device/function. To solve this,
> a sysfs field `dev_port' was introduced quite a while ago
> (commit v3.14-rc3-739-g3f85944fe207), and some relevant device
> drivers were fixed to use it, but not in case of IPoIB.
>
> The convention for some reason never got documented in the kernel, but
> was immediately adopted by userspace (notably udev[1][2], biosdevname[3])
>
> 3/3 documents the sysfs field — that's why I'm CC-ing netdev.
>
> This series was tested on and applies to 4.19-rc1.
>
> [1] https://lists.freedesktop.org/archives/systemd-devel/2014-June/020788.html
> [2] https://lists.freedesktop.org/archives/systemd-devel/2014-July/020804.html
> [3] https://github.com/CloudAutomationNTools/biosdevname/blob/c795d51dd93a5309652f0d635f12a3ecfabfaa72/src/eths.c#L38
>
> Arseny Maslennikov (3):
>   IB/ipoib: Use dev_port to expose network interface port numbers
>   IB/ipoib: Stop using dev_id to expose port numbers

I completely agree with previous Yuval's comment, it makes no sense to
start separate commits for every line.

Please decide what is best and right behavior and do it, instead of
pushing it up to be the maintainer's problem.

Thanks

>   Documentation/ABI: document /sys/class/net/*/dev_port
>
>  Documentation/ABI/testing/sysfs-class-net | 10 ++++++++++
>  drivers/infiniband/ulp/ipoib/ipoib_main.c |  2 +-
>  2 files changed, 11 insertions(+), 1 deletion(-)
>
> --
> 2.18.0
>

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

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

* Re: [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers
  2018-08-30  5:43 ` [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers Leon Romanovsky
@ 2018-08-30  8:42   ` Arseny Maslennikov
  0 siblings, 0 replies; 8+ messages in thread
From: Arseny Maslennikov @ 2018-08-30  8:42 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma, Doug Ledford, Jason Gunthorpe, netdev

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

On Thu, Aug 30, 2018 at 08:43:30AM +0300, Leon Romanovsky wrote:
> On Wed, Aug 29, 2018 at 12:01:14AM +0300, Arseny Maslennikov wrote:
> > Pre-3.15 userspace had trouble distinguishing different ports
> > of a NIC on a single PCI bus/device/function. To solve this,
> > a sysfs field `dev_port' was introduced quite a while ago
> > (commit v3.14-rc3-739-g3f85944fe207), and some relevant device
> > drivers were fixed to use it, but not in case of IPoIB.
> >
> > The convention for some reason never got documented in the kernel, but
> > was immediately adopted by userspace (notably udev[1][2], biosdevname[3])
> >
> > 3/3 documents the sysfs field — that's why I'm CC-ing netdev.
> >
> > This series was tested on and applies to 4.19-rc1.
> >
> > [1] https://lists.freedesktop.org/archives/systemd-devel/2014-June/020788.html
> > [2] https://lists.freedesktop.org/archives/systemd-devel/2014-July/020804.html
> > [3] https://github.com/CloudAutomationNTools/biosdevname/blob/c795d51dd93a5309652f0d635f12a3ecfabfaa72/src/eths.c#L38
> >
> > Arseny Maslennikov (3):
> >   IB/ipoib: Use dev_port to expose network interface port numbers
> >   IB/ipoib: Stop using dev_id to expose port numbers
> 
> I completely agree with previous Yuval's comment, it makes no sense to
> start separate commits for every line.
> 
> Please decide what is best and right behavior and do it, instead of
> pushing it up to be the maintainer's problem.
> 

No problem; will squash those two in v2, then.

> Thanks
> 
> >   Documentation/ABI: document /sys/class/net/*/dev_port
> >
> >  Documentation/ABI/testing/sysfs-class-net | 10 ++++++++++
> >  drivers/infiniband/ulp/ipoib/ipoib_main.c |  2 +-
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> >
> > --
> > 2.18.0
> >



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

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

* [PATCH 3/3] Documentation/ABI: document /sys/class/net/*/dev_port
  2018-08-13 11:42 [PATCH 0/3] net, IB/ipoib: Use dev_port to disambiguate Arseny Maslennikov
@ 2018-08-13 11:42 ` Arseny Maslennikov
  0 siblings, 0 replies; 8+ messages in thread
From: Arseny Maslennikov @ 2018-08-13 11:42 UTC (permalink / raw)
  To: linux-rdma; +Cc: Arseny Maslennikov, Doug Ledford, Jason Gunthorpe, netdev

The sysfs field was introduced 4 years ago along with fixes to various
drivers that erroneously used `dev_id' for that purpose, but it was not
properly documented anywhere.
See commit v3.14-rc3-739-g3f85944fe207.

Signed-off-by: Arseny Maslennikov <ar@cs.msu.ru>
---
 Documentation/ABI/testing/sysfs-class-net | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-net b/Documentation/ABI/testing/sysfs-class-net
index 2f1788111cd9..1593d8997ade 100644
--- a/Documentation/ABI/testing/sysfs-class-net
+++ b/Documentation/ABI/testing/sysfs-class-net
@@ -91,6 +91,16 @@ Description:
 		stacked (e.g: VLAN interfaces) but still have the same MAC
 		address as their parent device.
 
+What:		/sys/class/net/<iface>/dev_port
+Date:		February 2014
+KernelVersion:	3.15
+Contact:	netdev@vger.kernel.org
+Description:
+		Indicates the port number of this network device, formatted
+		as a decimal value. Some NICs have multiple independent ports
+		on the same PCI bus, device and function. This field allows
+		userspace to distinguish the respective interfaces.
+
 What:		/sys/class/net/<iface>/dormant
 Date:		March 2006
 KernelVersion:	2.6.17
-- 
2.18.0

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

end of thread, other threads:[~2018-08-30  8:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-28 21:01 [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers Arseny Maslennikov
2018-08-28 21:01 ` [PATCH 1/3] IB/ipoib: Use dev_port to expose network interface " Arseny Maslennikov
2018-08-28 21:01 ` [PATCH 2/3] IB/ipoib: Stop using dev_id to expose " Arseny Maslennikov
2018-08-29  9:44   ` Sergei Shtylyov
2018-08-28 21:01 ` [PATCH 3/3] Documentation/ABI: document /sys/class/net/*/dev_port Arseny Maslennikov
2018-08-30  5:43 ` [PATCH 0/3] IB/ipoib: Use dev_port to disambiguate port numbers Leon Romanovsky
2018-08-30  8:42   ` Arseny Maslennikov
  -- strict thread matches above, loose matches on Subject: below --
2018-08-13 11:42 [PATCH 0/3] net, IB/ipoib: Use dev_port to disambiguate Arseny Maslennikov
2018-08-13 11:42 ` [PATCH 3/3] Documentation/ABI: document /sys/class/net/*/dev_port Arseny Maslennikov

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.