public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Arseny Maslennikov <ar@cs.msu.ru>
To: linux-rdma@vger.kernel.org
Cc: Arseny Maslennikov <ar@cs.msu.ru>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	netdev@vger.kernel.org
Subject: [PATCH 1/3] IB/ipoib: Use dev_port to expose network interface port numbers
Date: Wed, 29 Aug 2018 00:01:15 +0300	[thread overview]
Message-ID: <20180828210117.6437-2-ar@cs.msu.ru> (raw)
In-Reply-To: <20180828210117.6437-1-ar@cs.msu.ru>

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

  reply	other threads:[~2018-08-28 21:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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 1/3] IB/ipoib: Use dev_port to expose network interface port numbers Arseny Maslennikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180828210117.6437-2-ar@cs.msu.ru \
    --to=ar@cs.msu.ru \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox