[ofw] RE: [PATCH] mlx4: add winverbs support
Leonid Keller
leonid at mellanox.co.il
Tue Aug 5 02:33:44 PDT 2008
OK with me.
You may apply it or, in turn, please, send a patch, adjusted to the HEAD
revision of the stack and I will apply. :(
> -----Original Message-----
> From: Sean Hefty [mailto:sean.hefty at intel.com]
> Sent: Monday, August 04, 2008 10:03 PM
> To: ofw at lists.openfabrics.org; Leonid Keller
> Subject: [PATCH] mlx4: add winverbs support
>
> Export the mlx4 channel interface via PnP query interface
> calls. This allows the driver to export its channel
> interface to multiple drivers, such as WinVerbs.
>
> The patch also converts UNIX line-endings to Windows format
> in two places.
>
> Signed-off-by: Sean Hefty <sean.hefty at intel.com>
> ---
> This allows mlx4 to support winverbs, similar to mthca
> support. With this, I was able to run the libibverbs
> examples and perftest programs on
> mlx4 on x64 Server 2003.
>
> I have not been able to run ibv_asyncwatch successfully on
> mlx4. I started a separate thread for this.
>
> Index: hw/mlx4/kernel/hca/drv.c
> ===================================================================
> --- hw/mlx4/kernel/hca/drv.c (revision 1448)
> +++ hw/mlx4/kernel/hca/drv.c (working copy)
> @@ -33,6 +33,7 @@
> #include "precomp.h"
> #include <initguid.h>
> #include <wdmguid.h>
> +#include <rdma\verbs.h>
>
> #if defined(EVENT_TRACING)
> #ifdef offsetof
> @@ -44,6 +45,9 @@
> #define DRV_VERSION "1.0"
> #define DRV_RELDATE "02/01/2008"
>
> +#define MLX_VERBS_MIN_VERSION 2
> +#define MLX_VERBS_MAX_VERSION 2
> +
> GLOBALS g;
>
> /*
> @@ -657,7 +661,7 @@
>
> /* get node GUID */
> err = __get_dev_info( p_fdo, &p_fdo->hca.guid,
> &p_fdo->hca.hw_ver );
> - if (err) {
> + if (err) {
>
> HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_LOW ,
> ("can't get guid - ib_query_device()
> failed (%08X)\n", err )); @@ -1039,6 +1043,12 @@
> OUT cl_irp_action_t* const
> p_action );
>
> static NTSTATUS
> +hca_query_interface(
> + IN DEVICE_OBJECT* const
> p_dev_obj,
> + IN IRP* const
> p_irp,
> + OUT cl_irp_action_t* const
> p_action );
> +
> +static NTSTATUS
> hca_query_pnp_state(
> IN DEVICE_OBJECT* const
> p_dev_obj,
> IN IRP* const
> p_irp,
> @@ -1110,6 +1120,7 @@
> #pragma alloc_text (PAGE, hca_cancel_remove) #pragma
> alloc_text (PAGE, hca_surprise_remove) #pragma alloc_text
> (PAGE, hca_query_capabilities)
> +#pragma alloc_text (PAGE, hca_query_interface)
> #pragma alloc_text (PAGE, hca_query_pnp_state) #pragma
> alloc_text (PAGE, hca_query_bus_relations) #pragma
> alloc_text (PAGE, hca_query_removal_relations) @@ -1767,10 +1778,12 @@
> p_fdo->bus_ib_ifc_taken = TRUE;
> p_fdo->bus_ib_ifc.p_ibdev->x.p_fdo = p_fdo;
>
> + InitializeListHead(&p_fdo->hca.event_list);
> + KeInitializeSpinLock(&p_fdo->hca.event_list_lock);
>
> /* get node GUID */
> err = __get_dev_info( p_fdo, &p_fdo->hca.guid,
> &p_fdo->hca.hw_ver );
> - if (err) {
> + if (err) {
>
> HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_LOW ,
> ("can't get guid - ib_query_device()
> failed (%08X)\n", err )); @@ -2043,7 +2056,102 @@ }
>
>
> +static VOID
> +__hca_noop( VOID *context )
> +{
> + UNREFERENCED_PARAMETER(context);
> +}
> +
> +
> static NTSTATUS
> +__query_ci_ifc(
> + IN DEVICE_OBJECT*
> const p_dev_obj,
> + IN
> IO_STACK_LOCATION* const p_io_stack )
> +{
> + RDMA_INTERFACE_VERBS *p_ifc;
> + PFDO_DEVICE_DATA p_fdo;
> + ci_interface_t *p_hca_ifc;
> + NTSTATUS status;
> + UINT8 version;
> +
> + HCA_ENTER( HCA_DBG_PNP );
> +
> + version =
> VerbsVersionMajor(p_io_stack->Parameters.QueryInterface.Version);
> + if( version < MLX_VERBS_MIN_VERSION || version >
> MLX_VERBS_MAX_VERSION )
> + {
> + status = STATUS_NOT_SUPPORTED;
> + goto exit;
> + }
> +
> + if( p_io_stack->Parameters.QueryInterface.Size <
> sizeof(RDMA_INTERFACE_VERBS) )
> + {
> + status = STATUS_BUFFER_TOO_SMALL;
> + goto exit;
> + }
> +
> + p_fdo = (PFDO_DEVICE_DATA)p_dev_obj->DeviceExtension;
> + p_hca_ifc = __alloc_hca_ifc( p_fdo );
> + if( !p_hca_ifc )
> + {
> + status = STATUS_NO_MEMORY;
> + goto exit;
> + }
> +
> + p_ifc = (RDMA_INTERFACE_VERBS *)
> +p_io_stack->Parameters.QueryInterface.Interface;
> +
> + p_ifc->InterfaceHeader.Size = sizeof(RDMA_INTERFACE_VERBS);
> + p_ifc->InterfaceHeader.Version = VerbsVersion(version, 0);
> + p_ifc->InterfaceHeader.Context = p_dev_obj;
> + p_ifc->InterfaceHeader.InterfaceReference = __hca_noop;
> + p_ifc->InterfaceHeader.InterfaceDereference = __hca_noop;
> + p_ifc->Verbs = *p_hca_ifc;
> + p_ifc->Verbs.p_hca_dev = &p_fdo->hca;
> +
> + ExFreePool( p_hca_ifc );
> + status = STATUS_SUCCESS;
> +
> +exit:
> + HCA_EXIT( HCA_DBG_PNP );
> + return status;
> +}
> +
> +
> +static NTSTATUS
> +hca_query_interface(
> + IN DEVICE_OBJECT* const
> p_dev_obj,
> + IN IRP* const
> p_irp,
> + OUT cl_irp_action_t* const
> p_action )
> +{
> + NTSTATUS status;
> + IO_STACK_LOCATION *p_io_stack;
> +
> + HCA_ENTER( HCA_DBG_PNP );
> +
> +#pragma warning( push, 3 )
> + PAGED_CODE();
> +#pragma warning( pop )
> +
> + p_io_stack = IoGetCurrentIrpStackLocation( p_irp );
> +
> + /* Compare requested GUID with our supported interface GUIDs. */
> + if( IsEqualGUID(
> p_io_stack->Parameters.QueryInterface.InterfaceType,
> + &GUID_RDMA_INTERFACE_VERBS ) )
> + {
> + status = __query_ci_ifc( p_dev_obj, p_io_stack );
> + *p_action = IrpComplete;
> + }
> + else
> + {
> + status = p_irp->IoStatus.Status;
> + *p_action = IrpSkip;
> + }
> +
> + HCA_EXIT( HCA_DBG_PNP );
> + return status;
> +}
> +
> +
> +static NTSTATUS
> hca_query_pnp_state(
> IN DEVICE_OBJECT* const
> p_dev_obj,
> IN IRP* const
> p_irp,
> @@ -2523,7 +2631,7 @@
> vfptrHcaPnp.pfn_query_resources = cl_irp_ignore;
> vfptrHcaPnp.pfn_query_res_req = cl_irp_ignore;
> vfptrHcaPnp.pfn_query_bus_info = cl_irp_ignore;
> - vfptrHcaPnp.pfn_query_interface = cl_irp_ignore;
> + vfptrHcaPnp.pfn_query_interface = hca_query_interface;
> vfptrHcaPnp.pfn_read_config = cl_irp_ignore;
> vfptrHcaPnp.pfn_write_config = cl_irp_ignore;
> vfptrHcaPnp.pfn_eject = cl_irp_ignore;
>
>
More information about the ofw
mailing list