linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kamal Heib <kamalheib1@gmail.com>
To: linux-rdma@vger.kernel.org
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	Doug Ledford <dledford@redhat.com>,
	Potnuri Bharat Teja <bharat@chelsio.com>,
	Selvin Xavier <selvin.xavier@broadcom.com>,
	Gal Pressman <galpress@amazon.com>,
	Leon Romanovsky <leon@kernel.org>,
	Michal Kalderon <mkalderon@marvell.com>,
	Christian Benvenuti <benve@cisco.com>,
	Moni Shoua <monis@mellanox.com>,
	Bernard Metzler <bmt@zurich.ibm.com>,
	Shiraz Saleem <shiraz.saleem@intel.com>,
	Andrew Boyer <aboyer@tobark.org>,
	Kamal Heib <kamalheib1@gmail.com>
Subject: [PATCH for-next V4 2/4] RDMA/cxgb3: Use ib_device_set_netdev()
Date: Wed,  7 Aug 2019 13:31:36 +0300	[thread overview]
Message-ID: <20190807103138.17219-3-kamalheib1@gmail.com> (raw)
In-Reply-To: <20190807103138.17219-1-kamalheib1@gmail.com>

This change is required to associate the cxgb3 ib_dev with the
underlying net_device, so in the upcoming patch we can call
ib_device_get_netdev().

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/cxgb3/iwch_provider.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index e775c1a1a450..5848e4727b2e 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -1273,8 +1273,24 @@ static const struct ib_device_ops iwch_dev_ops = {
 	INIT_RDMA_OBJ_SIZE(ib_ucontext, iwch_ucontext, ibucontext),
 };
 
+static int set_netdevs(struct ib_device *ib_dev, struct cxio_rdev *rdev)
+{
+	int ret;
+	int i;
+
+	for (i = 0; i < rdev->port_info.nports; i++) {
+		ret = ib_device_set_netdev(ib_dev, rdev->port_info.lldevs[i],
+					   i + 1);
+		if (ret)
+			return ret;
+	}
+	return 0;
+}
+
 int iwch_register_device(struct iwch_dev *dev)
 {
+	int err;
+
 	pr_debug("%s iwch_dev %p\n", __func__, dev);
 	memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid));
 	memcpy(&dev->ibdev.node_guid, dev->rdev.t3cdev_p->lldev->dev_addr, 6);
@@ -1315,6 +1331,10 @@ int iwch_register_device(struct iwch_dev *dev)
 
 	rdma_set_device_sysfs_group(&dev->ibdev, &iwch_attr_group);
 	ib_set_device_ops(&dev->ibdev, &iwch_dev_ops);
+	err = set_netdevs(&dev->ibdev, &dev->rdev);
+	if (err)
+		return err;
+
 	return ib_register_device(&dev->ibdev, "cxgb3_%d");
 }
 
-- 
2.20.1


  parent reply	other threads:[~2019-08-07 10:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 10:31 [PATCH for-next V4 0/4] RDMA: Cleanups and improvements Kamal Heib
2019-08-07 10:31 ` [PATCH for-next V4 1/4] RDMA: Introduce ib_port_phys_state enum Kamal Heib
2019-08-07 10:31 ` Kamal Heib [this message]
2019-08-07 10:31 ` [PATCH for-next V4 3/4] RDMA/core: Add common iWARP query port Kamal Heib
2019-08-07 10:31 ` [PATCH for-next V4 4/4] RDMA/{cxgb3, cxgb4, i40iw}: Remove common code Kamal Heib
2019-08-07 19:56 ` [PATCH for-next V4 0/4] RDMA: Cleanups and improvements Doug Ledford
2019-08-08  7:54   ` Leon Romanovsky
2019-08-08 20:38     ` Doug Ledford
2019-08-12 12:18       ` Jason Gunthorpe
2019-08-12 14:21         ` Doug Ledford

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=20190807103138.17219-3-kamalheib1@gmail.com \
    --to=kamalheib1@gmail.com \
    --cc=aboyer@tobark.org \
    --cc=benve@cisco.com \
    --cc=bharat@chelsio.com \
    --cc=bmt@zurich.ibm.com \
    --cc=dledford@redhat.com \
    --cc=galpress@amazon.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mkalderon@marvell.com \
    --cc=monis@mellanox.com \
    --cc=selvin.xavier@broadcom.com \
    --cc=shiraz.saleem@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).