<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=873484906-19052008>The following
checkin, is the first one needed in order to allow Connectx to support IB
devices as well as Ethernet devices.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=873484906-19052008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=873484906-19052008>More changes will
follow in the future.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=873484906-19052008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=873484906-19052008>Thanks</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=873484906-19052008>Tzachi</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Index:
mlx4/kernel/bus/drv/drv.c<BR>===================================================================<BR>---
mlx4/kernel/bus/drv/drv.c (revision 1182)<BR>+++
mlx4/kernel/bus/drv/drv.c (working copy)<BR>@@ -105,6 +105,7
@@<BR> __create_child(<BR> __in WDFDEVICE
Device,<BR> __in PWCHAR
HardwareIds,<BR>+ __in PWCHAR
DeviceDescription,<BR> __in ULONG
SerialNo<BR> )<BR> <BR>@@ -189,7 +190,7
@@<BR> // the list locked for enumeration. The
enumeration lock applies only<BR> // to enumeration, not
addition or removal.<BR> //<BR>- status =
create_pdo(Device, HardwareIds, SerialNo);<BR>+ status =
create_pdo(Device, HardwareIds, DeviceDescription,
SerialNo);<BR> }<BR> <BR> WdfFdoUnlockStaticChildListFromIteration(Device);<BR>@@
-199,7 +200,18 @@<BR> return status;<BR> }<BR> <BR>+//
TODO: Replace this functions with real ones<BR>+int mlx4_count_ib_ports()
{<BR>+ return 1;<BR>+}<BR> <BR>+BOOLEAN mlx4_is_eth_port(int
port_id)<BR>+{<BR>+ if ( port_id == 0 )return FALSE;<BR>+ return
FALSE;<BR>+}<BR>+<BR>+<BR> NTSTATUS<BR> __do_static_enumeration(<BR> IN
WDFDEVICE Device<BR>@@ -220,15 +232,36
@@<BR> --*/<BR> <BR> {<BR>- NTSTATUS
status;<BR>+ NTSTATUS status = STATUS_SUCCESS;<BR>+ int
i;<BR>+ int number_of_ib_ports;<BR> <BR>+ // TODO:Need to add an
event log in the case of
errors<BR>+<BR> MLX4_ENTER(MLX4_DBG_DRV);<BR> <BR>- //
eventually we'll have all information about children in Registry<BR>+ //
eventually we'll have all information about children in
Registry<BR> // DriverEntry will read it into a Global storage
and<BR> // this routine will create all the children on base on this
info<BR>+ number_of_ib_ports =
mlx4_count_ib_ports();<BR>+ ASSERT(number_of_ib_ports >=0 &&
number_of_ib_ports <=2);<BR>+ <BR>+ if(number_of_ib_ports > 0)
{<BR>+ status = __create_child(Device, BUS_HARDWARE_IDS,
BUS_HARDWARE_DESCRIPTION, 0 );<BR>+ if (!NT_SUCCESS(status))
{<BR>+ MLX4_PRINT(TRACE_LEVEL_ERROR, MLX4_DBG_DRV,
("__create_child (ib)failed with 0x%x\n",
status));<BR>+ }<BR>+ }<BR> <BR>- status =
__create_child(Device, BUS_HARDWARE_IDS, 0 );<BR>+ // Create ethernet ports
if needed<BR>+ for (i = 0; i < MLX4_MAX_PORTS; i++)
{<BR>+ if(mlx4_is_eth_port(i)) {<BR>+ status =
__create_child(Device, ETH_HARDWARE_IDS, ETH_HARDWARE_DESCRIPTION, i+1
);<BR>+ if (!NT_SUCCESS(status)) {<BR>+
MLX4_PRINT(TRACE_LEVEL_ERROR, MLX4_DBG_DRV, ("__create_child (eth) failed with
0x%x\n",
status));<BR>+ }<BR>+ }<BR>+ }<BR> <BR> MLX4_EXIT(
MLX4_DBG_DRV );<BR> return status;<BR>@@ -251,7 +284,7
@@<BR> <BR> status =
__do_static_enumeration(Device);<BR> if (!NT_SUCCESS(status))
{<BR>- MLX4_PRINT(TRACE_LEVEL_ERROR, MLX4_DBG_DRV,
("DoStaticEnumeration failed with 0x%x\n", status));<BR>+
MLX4_PRINT(TRACE_LEVEL_ERROR, MLX4_DBG_DRV, ("__do_static_enumeration failed
with 0x%x\n", status));<BR> }<BR> <BR> {<BR>@@ -516,7
+549,7 @@<BR> // get resources<BR> status =
__get_resources( p_fdo, ResourcesRaw, ResourcesTranslated );<BR> if(
!NT_SUCCESS( status ) ) {<BR>- MLX4_PRINT(TRACE_LEVEL_ERROR,
MLX4_DBG_DRV, ("__get_bus_ifc failed: status=0x%x\n",
status));<BR>+ MLX4_PRINT(TRACE_LEVEL_ERROR, MLX4_DBG_DRV,
("__get_resources failed: status=0x%x\n", status));<BR> goto
err;<BR> }<BR> <BR>@@ -567,11 +600,11
@@<BR> //<BR> <BR> // fill the
header<BR>- p_fdo->bus_ib_ifc.Size =
sizeof(MLX4_BUS_IB_INTERFACE);<BR>- p_fdo->bus_ib_ifc.Version =
MLX4_BUS_IB_INTERFACE_VERSION;<BR>+ p_fdo->bus_ib_ifc.i.Size =
sizeof(MLX4_BUS_IB_INTERFACE);<BR>+ p_fdo->bus_ib_ifc.i.Version =
MLX4_BUS_IB_INTERFACE_VERSION;<BR> // Let the framework handle
reference counting.<BR>- p_fdo->bus_ib_ifc.InterfaceReference =
WdfDeviceInterfaceReferenceNoOp;<BR>- p_fdo->bus_ib_ifc.InterfaceDereference
=
WdfDeviceInterfaceDereferenceNoOp;<BR>+ p_fdo->bus_ib_ifc.i.InterfaceReference
=
WdfDeviceInterfaceReferenceNoOp;<BR>+ p_fdo->bus_ib_ifc.i.InterfaceDereference
=
WdfDeviceInterfaceDereferenceNoOp;<BR> <BR> p_fdo->bus_ib_ifc.pdev
= &p_fdo->pci_dev;<BR> p_fdo->bus_ib_ifc.p_ibdev =
p_fdo->pci_dev.ib_dev;<BR>@@ -1001,3 +1034,4
@@<BR> }<BR> <BR> <BR>+<BR>Index:
mlx4/kernel/bus/drv/drv.h<BR>===================================================================<BR>---
mlx4/kernel/bus/drv/drv.h (revision 1182)<BR>+++
mlx4/kernel/bus/drv/drv.h (working copy)<BR>@@ -67,6 +67,8
@@<BR> int dma_adapter_taken;<BR> res_interrupt_t interrupt[MLX4_MAX_INTERRUPTS];<BR> MLX4_BUS_IB_INTERFACE bus_ib_ifc;<BR>+ //
Data for the Ethernet device<BR>+ struct
VipBusIfc mtnic_Ifc;<BR> <BR> } FDO_DEVICE_DATA,
*PFDO_DEVICE_DATA;<BR> <BR>@@ -216,6 +218,8
@@<BR> create_pdo(<BR> __in WDFDEVICE
Device,<BR> __in PWCHAR
HardwareIds,<BR>+ __in PWCHAR
DeviceDescription,<BR> __in ULONG
SerialNo<BR> );<BR> <BR>+<BR>Index:
mlx4/kernel/bus/drv/pdo.c<BR>===================================================================<BR>---
mlx4/kernel/bus/drv/pdo.c (revision 1182)<BR>+++
mlx4/kernel/bus/drv/pdo.c (working copy)<BR>@@ -16,6 +16,7
@@<BR> create_pdo(<BR> __in WDFDEVICE
Device,<BR> __in PWCHAR
HardwareIds,<BR>+ __in PWCHAR
DeviceDescription,<BR> __in ULONG
SerialNo<BR> )<BR> /*++<BR>@@ -40,13 +41,14
@@<BR> WDF_OBJECT_ATTRIBUTES
pdoAttributes;<BR> WDF_DEVICE_PNP_CAPABILITIES
pnpCaps;<BR> WDF_DEVICE_POWER_CAPABILITIES
powerCaps;<BR>- DECLARE_CONST_UNICODE_STRING(compatId,
BUSENUM_COMPATIBLE_IDS);<BR>+ UNICODE_STRING
compatId;<BR> DECLARE_CONST_UNICODE_STRING(deviceLocation, L"MLX4 Bus
0");<BR> UNICODE_STRING
deviceId;<BR> DECLARE_UNICODE_STRING_SIZE(buffer,
MAX_ID_LEN);<BR> <BR> MLX4_PRINT(TRACE_LEVEL_INFORMATION,
MLX4_DBG_DRV, ("Entered
CreatePdo\n"));<BR> <BR>+ RtlInitUnicodeString(&compatId,
HardwareIds);<BR> PAGED_CODE();<BR> <BR> //<BR>@@
-107,7 +109,8 @@<BR> // coinstallers to display in the device
manager. FriendlyName takes<BR> // precedence over the DeviceDesc
from the INF file.<BR> //<BR>- status =
RtlUnicodeStringPrintf(&buffer,L"Mellanox ConnectX Virtual Infiniband
Adapter (#%02d)", SerialNo );<BR>+ status =
RtlUnicodeStringPrintf(&buffer,DeviceDescription , SerialNo
);<BR>+ <BR> if (!NT_SUCCESS(status))
{<BR> goto Cleanup;<BR> }<BR>@@ -181,11 +184,14
@@<BR> <BR> WdfDeviceSetPowerCapabilities(hChild,
&powerCaps);<BR> <BR>+ p_fdo->bus_ib_ifc.port_id =
SerialNo;<BR>+ p_fdo->bus_ib_ifc.pVipBusIfc =
&p_fdo->mtnic_Ifc;<BR>+ p_fdo->bus_ib_ifc.pVipBusIfc->ulAllocatePortObjSize
= MAX_PORT_SIZE;<BR> //<BR> // Create a custom interface
so that other drivers can<BR> // query (IRP_MN_QUERY_INTERFACE) and
use our callbacks
directly.<BR> //<BR>- p_fdo->bus_ib_ifc.Context =
p_pdo;<BR>+ p_fdo->bus_ib_ifc.i.Context =
p_pdo;<BR> <BR> WDF_QUERY_INTERFACE_CONFIG_INIT(
&p_pdo->qiMlx4Bus,<BR> (PINTERFACE)
&p_fdo->bus_ib_ifc,<BR>@@ -238,3 +244,4 @@<BR> return
status;<BR> }<BR> <BR>+<BR>Index:
mlx4/kernel/bus/drv/precomp.h<BR>===================================================================<BR>---
mlx4/kernel/bus/drv/precomp.h (revision 1182)<BR>+++
mlx4/kernel/bus/drv/precomp.h (working copy)<BR>@@ -6,6 +6,7
@@<BR> #include "public.h"<BR> #include "l2w.h"<BR> #include
"ib\mlx4_ib.h"<BR>+#include "vip_dev.h"<BR> #include "drv.h"<BR> #if
0<BR> #include "mxe_hca.h"<BR>@@ -16,3 +17,4 @@<BR> #include
"mxe_drv.h"<BR> #endif<BR> <BR>+<BR>Index:
mlx4/kernel/bus/inc/bus_intf.h<BR>===================================================================<BR>---
mlx4/kernel/bus/inc/bus_intf.h (revision 1182)<BR>+++
mlx4/kernel/bus/inc/bus_intf.h (working copy)<BR>@@ -1,17 +1,21
@@<BR> #pragma once<BR> <BR>-#define
MLX4_BUS_IB_INTERFACE_VERSION 1<BR>+#define
MLX4_BUS_IB_INTERFACE_VERSION 2<BR> <BR> //<BR> //
Interface for work with MLX4 IB driver<BR> //<BR>+<BR> #pragma
warning(disable:4201) // nameless struct/union<BR> typedef struct
_MLX4_BUS_IB_INTERFACE{<BR>- INTERFACE;<BR>+ INTERFACE
i;<BR> struct
ib_device * p_ibdev;<BR> struct
pci_dev * pdev;<BR> int is_livefish;<BR>+ ULONG port_id;<BR>+ struct
VipBusIfc *pVipBusIfc;<BR> <BR> }
MLX4_BUS_IB_INTERFACE, *PMLX4_BUS_IB_INTERFACE;<BR> #pragma
warning(default:4201) // nameless
struct/union<BR> <BR>+<BR></DIV></FONT></BODY></HTML>