[Openib-windows] Getting the HCA pdo

Fabian Tillier ftillier at silverstorm.com
Fri Sep 22 15:39:49 PDT 2006


Hi again Jan,

On 9/22/06, Fabian Tillier <ftillier at silverstorm.com> wrote:
> Hi Jan,
>
> On 9/22/06, Jan Bottorff <jbottorff at xsigo.com> wrote:
> >
> > Can someone suggest a better way to obtain the actual hca device pdo (or
> > appropriate lower device object) to pass to IoGetDMAAdapter. It offhand
> > seems like the IBAL interface is missing important functionality, as you
> > need physical addresses in QP work requests but don't offhand see any calls
> > to get a dma adapter object given an hca/port?
>
> An other alternative is to add a function to the access layer
> interface structure used by kernel clients.  I think I prefer this
> solution.

Here's a patch that adds a new function to the interface: get_ca_dev.
This function returns the pointer to the HCA's device object.  Before
returning the pointer it takes a reference on the object.  The caller
is expected to release the reference when they're done with the object
using ObDereferenceObject.

Let me know if this does the trick for you, and if so if it works as
expected and I will check it in.

Thanks,

- Fab

Index: core/bus/kernel/bus_pnp.c
===================================================================
--- core/bus/kernel/bus_pnp.c	(revision 498)
+++ core/bus/kernel/bus_pnp.c	(working copy)
@@ -596,6 +596,7 @@
 	p_ifc->sync_destroy = ib_sync_destroy;
 	p_ifc->open_ca = ib_open_ca;
 	p_ifc->query_ca = ib_query_ca;
+	p_ifc->get_dev = get_ca_dev;
 	p_ifc->close_ca = ib_close_ca;
 	p_ifc->alloc_pd = ib_alloc_pd;
 	p_ifc->dealloc_pd = ib_dealloc_pd;
Index: core/al/kernel/al_ci_ca.c
===================================================================
--- core/al/kernel/al_ci_ca.c	(revision 498)
+++ core/al/kernel/al_ci_ca.c	(working copy)
@@ -507,3 +507,14 @@
 	AL_EXIT( AL_DBG_QUERY );
 	return status;
 }
+
+
+DEVICE_OBJECT*
+get_ca_dev(
+	IN		const	ib_ca_handle_t				h_ca )
+{
+	ASSERT( h_ca );
+
+	ObReferenceObject( h_ca->obj.p_ci_ca->verbs.p_hca_dev );
+	return h_ca->obj.p_ci_ca->verbs.p_hca_dev;
+}
\ No newline at end of file
Index: core/al/al_ci_ca.h
===================================================================
--- core/al/al_ci_ca.h	(revision 498)
+++ core/al/al_ci_ca.h	(working copy)
@@ -56,6 +56,10 @@
 create_ci_ca(
 	IN				al_obj_t					*p_parent_obj,
 	IN		const	ci_interface_t*				p_ci );
+
+DEVICE_OBJECT*
+get_ca_dev(
+	IN		const	ib_ca_handle_t				h_ca );
 #endif


Index: inc/kernel/iba/ib_al_ifc.h
===================================================================
--- inc/kernel/iba/ib_al_ifc.h	(revision 498)
+++ inc/kernel/iba/ib_al_ifc.h	(working copy)
@@ -47,7 +47,7 @@
 *	IB resources provided by HCAs.
 *********/

-#define AL_INTERFACE_VERSION		(8)
+#define AL_INTERFACE_VERSION		(9)



@@ -70,6 +70,10 @@
 		OUT			ib_ca_attr_t* const			p_ca_attr OPTIONAL,
 	IN	OUT			uint32_t* const				p_size );

+typedef DEVICE_OBJECT*
+(*ib_pfn_get_ca_dev_t)(
+	IN		const	ib_ca_handle_t				h_ca );
+
 typedef ib_api_status_t
 (*ib_pfn_query_ca_by_guid_t)(
 	IN		const	ib_al_handle_t				h_al,
@@ -598,6 +602,7 @@
 	ib_pfn_sync_destroy_t		sync_destroy;
 	ib_pfn_open_ca_t			open_ca;
 	ib_pfn_query_ca_t			query_ca;
+	ib_pfn_get_ca_dev_t			get_dev;
 	ib_pfn_close_ca_t			close_ca;
 	ib_pfn_alloc_pd_t			alloc_pd;
 	ib_pfn_dealloc_pd_t			dealloc_pd;
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: get_ca_dev.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20060922/5302d12d/attachment.ksh>


More information about the ofw mailing list