linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mike Marciniszyn
	<mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 23/37] IB/rdmavt: Move driver helper functions to a common structure
Date: Mon, 07 Dec 2015 15:44:39 -0500	[thread overview]
Message-ID: <20151207204438.8144.99737.stgit@phlsvslse11.ph.intel.com> (raw)
In-Reply-To: <20151207204046.8144.18752.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>

Drivers are going to need to provide multiple functions for rdmavt to
call in to. We already have one, so go ahead and push this into a
data structure designated for driver supplied functions.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/sw/rdmavt/vt.c |    6 +++++-
 include/rdma/rdma_vt.h            |   22 +++++++++++++++-------
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c
index a1667ea..4bd0e20 100644
--- a/drivers/infiniband/sw/rdmavt/vt.c
+++ b/drivers/infiniband/sw/rdmavt/vt.c
@@ -287,8 +287,12 @@ int rvt_register_device(struct rvt_dev_info *rdi)
 	spin_lock_init(&rdi->n_pds_lock);
 	rdi->n_pds_allocated = 0;
 
+	/* Validate that drivers have provided the right functions */
+	if (!rdi->driver_f.port_callback)
+		return -EINVAL;
+
 	/* We are now good to announce we exist */
-	return ib_register_device(&rdi->ibdev, rdi->port_callback);
+	return ib_register_device(&rdi->ibdev, rdi->driver_f.port_callback);
 }
 EXPORT_SYMBOL(rvt_register_device);
 
diff --git a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
index 8d3a41a..8e3520b 100644
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -386,6 +386,19 @@ struct rvt_driver_params {
 	 */
 };
 
+/*
+ * Functions that drivers are required to support
+ */
+struct rvt_driver_provided {
+	/*
+	 * The work to create port files in /sys/class Infiniband is different
+	 * depending on the driver. This should not be extracted away and
+	 * instead drivers are responsible for setting the correct callback for
+	 * this.
+	 */
+	int (*port_callback)(struct ib_device *, u8, struct kobject *);
+};
+
 /* Protection domain */
 struct rvt_pd {
 	struct ib_pd ibpd;
@@ -413,13 +426,8 @@ struct rvt_dev_info {
 
 	/* PKey Table goes here */
 
-	/*
-	 * The work to create port files in /sys/class Infiniband is different
-	 * depending on the driver. This should not be extracted away and
-	 * instead drivers are responsible for setting the correct callback for
-	 * this.
-	 */
-	int (*port_callback)(struct ib_device *, u8, struct kobject *);
+	/* Driver specific helper functions */
+	struct rvt_driver_provided driver_f;
 
 	/* Internal use */
 	int n_pds_allocated;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-12-07 20:44 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 20:42 [PATCH 00/37] Add rdma verbs transport library Dennis Dalessandro
     [not found] ` <20151207204046.8144.18752.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-07 20:43   ` [PATCH 01/37] IB/rdmavt: Create module framework and handle driver registration Dennis Dalessandro
     [not found]     ` <20151207204300.8144.20089.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-07 21:28       ` Hefty, Sean
2015-12-08  5:55       ` Leon Romanovsky
     [not found]         ` <20151208055545.GC7313-2ukJVAZIZ/Y@public.gmane.org>
2015-12-08 23:06           ` Dennis Dalessandro
     [not found]             ` <20151208230612.GB14221-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-08 23:10               ` Hefty, Sean
2015-12-10 11:49       ` Haggai Eran
     [not found]         ` <566966CB.4080700-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-10 13:18           ` Dennis Dalessandro
2015-12-07 20:43   ` [PATCH 02/37] IB/rdmavt: Consolidate dma ops in rdmavt Dennis Dalessandro
     [not found]     ` <20151207204305.8144.7038.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-08  6:08       ` Leon Romanovsky
     [not found]         ` <20151208060821.GD7313-2ukJVAZIZ/Y@public.gmane.org>
2015-12-10 16:17           ` Dennis Dalessandro
     [not found]             ` <20151210161708.GA13412-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-10 17:44               ` Jason Gunthorpe
     [not found]                 ` <20151210174413.GB21482-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-12-10 23:41                   ` Christoph Hellwig
     [not found]                     ` <20151210234112.GA15546-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-12-11  0:29                       ` Jason Gunthorpe
     [not found]                         ` <20151211002950.GA5964-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-12-11  0:46                           ` Christoph Hellwig
     [not found]                             ` <20151211004624.GA9994-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-12-11  6:02                               ` Jason Gunthorpe
     [not found]                                 ` <20151211060202.GA16513-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-12-11 14:10                                   ` Christoph Hellwig
2015-12-10 17:52               ` Leon Romanovsky
     [not found]                 ` <20151210175231.GD8662-2ukJVAZIZ/Y@public.gmane.org>
2015-12-10 19:52                   ` Dennis Dalessandro
2015-12-10 12:07       ` Haggai Eran
2015-12-07 20:43   ` [PATCH 03/37] IB/rdmavt: Add protection domain to rdmavt Dennis Dalessandro
     [not found]     ` <20151207204309.8144.26707.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-07 21:13       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AAFE7252-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-12-08 19:08           ` ira.weiny
     [not found]             ` <20151208190854.GA16976-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-08 19:17               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A82373AAFE79BE-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-12-08 19:52                   ` ira.weiny
     [not found]                     ` <20151208195236.GC16976-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-10 16:49                       ` Dennis Dalessandro
     [not found]                         ` <20151210164939.GD13412-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-10 18:59                           ` ira.weiny
     [not found]                             ` <20151210185944.GA7855-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-10 19:10                               ` Hefty, Sean
2015-12-08  6:28       ` Leon Romanovsky
     [not found]         ` <20151208062816.GE7313-2ukJVAZIZ/Y@public.gmane.org>
2015-12-08  7:20           ` Leon Romanovsky
     [not found]             ` <20151208072027.GF7313-2ukJVAZIZ/Y@public.gmane.org>
2015-12-10 16:45               ` Dennis Dalessandro
2015-12-10 16:40           ` Dennis Dalessandro
     [not found]             ` <20151210164047.GB13412-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-10 17:54               ` Leon Romanovsky
2015-12-07 20:43   ` [PATCH 04/37] IB/rdmavt: Add ib core device attributes to rvt driver params list Dennis Dalessandro
     [not found]     ` <20151207204314.8144.46170.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-10 12:26       ` Haggai Eran
     [not found]         ` <56696F63.90707-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-10 13:25           ` Dennis Dalessandro
     [not found]             ` <20151210132523.GB11526-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-10 15:12               ` Haggai Eran
     [not found]                 ` <56699674.3030900-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-10 15:22                   ` Dennis Dalessandro
2015-12-10 12:29       ` Haggai Eran
     [not found]         ` <5669701E.7090302-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-10 13:35           ` Dennis Dalessandro
2015-12-07 20:43   ` [PATCH 05/37] IB/rdmavt: Macroize override checks during driver registration Dennis Dalessandro
     [not found]     ` <20151207204318.8144.29135.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-07 21:23       ` Hefty, Sean
2015-12-07 20:43   ` [PATCH 06/37] IB/rdmavt: Add query and modify device stubs Dennis Dalessandro
     [not found]     ` <20151207204322.8144.60452.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-07 21:26       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AAFE72C8-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-12-07 21:39           ` Jason Gunthorpe
     [not found]             ` <20151207213904.GA3113-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-12-08  7:29               ` Leon Romanovsky
2015-12-07 20:43   ` [PATCH 07/37] IB/rdmavt: Add query and modify port stubs Dennis Dalessandro
     [not found]     ` <20151207204327.8144.17959.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-08  8:06       ` Leon Romanovsky
2015-12-07 20:43   ` [PATCH 08/37] IB/rdmavt: Add pkey query stub Dennis Dalessandro
2015-12-07 20:43   ` [PATCH 09/37] IB/rdmavt: Add query gid stub Dennis Dalessandro
2015-12-07 20:43   ` [PATCH 10/37] IB/rdmavt: Alloc and dealloc ucontexts Dennis Dalessandro
2015-12-07 20:43   ` [PATCH 11/37] IB/rdmavt: Add queue pair function stubs Dennis Dalessandro
2015-12-07 20:43   ` [PATCH 12/37] IB/rdmavt: Add address handle stubs Dennis Dalessandro
2015-12-07 20:43   ` [PATCH 13/37] IB/rdmavt: Add memory region stubs Dennis Dalessandro
2015-12-07 20:43   ` [PATCH 14/37] IB/rdmavt: Add SRQ stubs Dennis Dalessandro
2015-12-07 20:44   ` [PATCH 15/37] IB/rdmavt: Add multicast stubs Dennis Dalessandro
2015-12-07 20:44   ` [PATCH 16/37] IB/rdmavt: Add process MAD stub Dennis Dalessandro
2015-12-07 20:44   ` [PATCH 17/37] IB/rdmavt: Add mmap stub Dennis Dalessandro
2015-12-07 20:44   ` [PATCH 18/37] IB/rdmavt: Add get port immutable stub Dennis Dalessandro
2015-12-07 20:44   ` [PATCH 19/37] IB/rdmavt: Add completion queue function stubs Dennis Dalessandro
2015-12-07 20:44   ` [PATCH 20/37] IB/rdamvt: Add post send and recv stubs Dennis Dalessandro
     [not found]     ` <20151207204425.8144.34725.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-08 10:28       ` Moni Shoua
2015-12-07 20:44   ` [PATCH 21/37] IB/rdmavt: Move MR datastructures into rvt Dennis Dalessandro
     [not found]     ` <20151207204429.8144.62688.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-07 21:39       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AAFE7322-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-12-14 16:07           ` Dennis Dalessandro
2015-12-07 20:44   ` [PATCH 22/37] IB/rdmavt: Add queue pair data structure to rdmavt Dennis Dalessandro
     [not found]     ` <20151207204433.8144.93461.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-07 21:48       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AAFE733B-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-12-10 19:06           ` Dennis Dalessandro
     [not found]             ` <20151210190656.GE13412-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-10 19:12               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A82373AAFE87E8-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-12-14 16:29                   ` Dennis Dalessandro
2015-12-07 20:44   ` Dennis Dalessandro [this message]
2015-12-07 20:44   ` [PATCH 24/37] IB/rdmavt: Add device specific info prints Dennis Dalessandro
2015-12-07 20:44   ` [PATCH 25/37] IB/rdmavt: Add the start of capability flags Dennis Dalessandro
2015-12-07 20:44   ` [PATCH 26/37] IB/rdmavt: Move memory registration into rdmavt Dennis Dalessandro
     [not found]     ` <20151207204451.8144.52356.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-10 14:24       ` Sagi Grimberg
     [not found]         ` <56698B2C.2010806-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-10 15:14           ` Dennis Dalessandro
     [not found]             ` <20151210151455.GD11526-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-10 15:25               ` Christoph Hellwig
2015-12-07 20:44   ` [PATCH 27/37] IB/rdmavt: Do not use rvt prints which rely on driver too early Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 28/37] IB/rdmavt: Add common LID defines to rdmavt Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 29/37] IB/rdmavt: Add AH " Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 30/37] IB/rdmavt: Move SRQ data structure into rdmavt Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 31/37] IB/rdmavt: Add an ibport data structure to rdmavt Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 32/37] IB/rdmavt: Add driver notification for new AH Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 33/37] IB/rdmavt: Break rdma_vt main include header file up Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 34/37] IB/rdmavt: Initialize and teardown of qpn table Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 35/37] IB/rdmavt: Add mmap related functions Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 36/37] IB/rdmavt: Add pkey support Dennis Dalessandro
2015-12-07 20:45   ` [PATCH 37/37] IB/rdmavt: Add support for new memory registration API Dennis Dalessandro
     [not found]     ` <20151207204540.8144.94303.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-12-10 15:02       ` Sagi Grimberg
     [not found]         ` <5669940D.4040402-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-14 16:18           ` Sagi Grimberg
     [not found]             ` <566EEBE8.8020007-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-14 17:14               ` Dennis Dalessandro
     [not found]                 ` <20151214171440.GC23833-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-16 13:21                   ` Sagi Grimberg
     [not found]                     ` <5671653E.40501-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-16 14:22                       ` Dennis Dalessandro
     [not found]                         ` <20151216142224.GA28117-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-16 14:37                           ` Sagi Grimberg
     [not found]                             ` <56717733.7070105-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-17 15:52                               ` Dennis Dalessandro
     [not found]                                 ` <20151217155228.GA29455-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-17 16:35                                   ` Christoph Hellwig
     [not found]                                     ` <20151217163553.GA22222-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-12-17 16:49                                       ` Dennis Dalessandro
2015-12-07 21:17   ` [PATCH 00/37] Add rdma verbs transport library Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A82373AAFE7265-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-12-08 22:59       ` Dennis Dalessandro
2015-12-09 12:21   ` Moni Shoua
     [not found]     ` <CAG9sBKPYwG3ug+CEOV--tLXcaa-M_1k5W6+LUeO7RciiRmeh7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-09 17:11       ` Dennis Dalessandro

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=20151207204438.8144.99737.stgit@phlsvslse11.ph.intel.com \
    --to=dennis.dalessandro-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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;
as well as URLs for NNTP newsgroup(s).