[OFW][patch] partition tool
Tzachi Dar
tzachid at mellanox.co.il
Sun May 4 05:41:54 PDT 2008
Can you please send your patch against the latest OFED (after the
changes to the __ptr64).
Thanks
Tzachi
________________________________
From: ofw-bounces at lists.openfabrics.org
[mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Slava Strebkov
Sent: Tuesday, April 29, 2008 4:31 PM
To: ofw at lists.openfabrics.org
Subject: [OFW][patch] partition tool
Attached patch implements partition feature.
Application (part_man.exe) is used for adding and removing
partition key values from ibbus service registry entry.
When adding a new pkey, an IOCTL contained new pkey value(s) is
send to ibbus. New pdo(s) created for requested pkey value(s).
Upon reboot, ibbus reads registry and creates new pdo(s) for
found pkey value(s).
Index: core/al/al_dev.h
===================================================================
--- core/al/al_dev.h (revision 1081)
+++ core/al/al_dev.h (working copy)
@@ -56,7 +56,14 @@
#define AL_IOCTL_VERSION (4)
+/* max number of devices with non-default pkey */
+#define MAX_NUM_PKEY 16
+typedef struct _pkey_array
+{
+ ib_net16_t pkey_num;
+ ib_net16_t pkey_array[MAX_NUM_PKEY];
+}pkey_array_t;
#ifdef CL_KERNEL
/* Function prototypes for al device framework */
@@ -82,6 +89,9 @@
IN
DEVICE_OBJECT *p_dev_obj,
IN IRP
*p_irp );
+cl_status_t
+bus_add_pkey(
+ IN
cl_ioctl_handle_t h_ioctl );
/* Define data structures for user-mode proxy */
#else /* CL_KERNEL */
@@ -132,7 +142,7 @@
ual_bind_cq,
ual_bind_destroy,
ual_bind_nd,
-
+ ual_req_create_pdo,
al_proxy_maxops
} al_proxy_ops_t;
@@ -156,6 +166,7 @@
#define UAL_BIND_CQ
IOCTL_CODE(ALDEV_KEY, ual_bind_cq)
#define UAL_BIND_DESTROY IOCTL_CODE(ALDEV_KEY,
ual_bind_destroy)
#define UAL_BIND_ND
IOCTL_CODE(ALDEV_KEY, ual_bind_nd)
+#define UAL_REQ_CREATE_PDO IOCTL_CODE(ALDEV_KEY,
ual_req_create_pdo)
#define AL_PROXY_OPS_START IOCTL_CODE(ALDEV_KEY,
al_proxy_ops_start)
#define AL_PROXY_MAXOPS IOCTL_CODE(ALDEV_KEY,
al_proxy_maxops)
Index: core/al/kernel/al_proxy.c
===================================================================
--- core/al/kernel/al_proxy.c (revision 1081)
+++ core/al/kernel/al_proxy.c (working copy)
@@ -705,6 +705,9 @@
case UAL_BIND_ND:
cl_status = proxy_bind_file( h_ioctl,
AL_OBJ_TYPE_NDI );
break;
+ case UAL_REQ_CREATE_PDO:
+ cl_status = bus_add_pkey( h_ioctl);
+ break;
default:
cl_status = CL_INVALID_PARAMETER;
break;
Index: core/bus/kernel/bus_driver.c
===================================================================
--- core/bus/kernel/bus_driver.c (revision 1081)
+++ core/bus/kernel/bus_driver.c (working copy)
@@ -42,8 +42,8 @@
#include "al_dev.h"
#include "al_debug.h"
#include <complib/cl_init.h>
+#include "iba/ipoib_ifc.h"
-
#if defined(EVENT_TRACING)
#ifdef offsetof
#undef offsetof
@@ -56,8 +56,9 @@
#else
#define DEFAULT_NODE_DESC "OpenIB Windows(r) Host"
#endif
+/* pkey array to be read */
+pkey_array_t g_pkeys;
-
char node_desc[IB_NODE_DESCRIPTION_SIZE];
bus_globals_t bus_globals = {
@@ -181,24 +182,160 @@
RtlStringCbCopyNA( node_desc,
sizeof(node_desc),
DEFAULT_NODE_DESC,
sizeof(DEFAULT_NODE_DESC) );
}
-
+}
+/**********************************************************************
**************
+* name : __prepare_pKey_array
+* parses registry string and exrtacts pkey value(s)
from it.
+* pkey pattern is 0xABCD
+* input : UNICODE_STRING *str
+* output: pkey_array
+* return: uint16_t number of pkey(s) found
+***********************************************************************
**************/
+static uint16_t __prepare_pKey_array(IN const UNICODE_STRING
*str, OUT uint16_t *pkey_array)
+{
+ uint16_t i, num_pKeys, cur_pkey_length;
+ NTSTATUS status;
+ ANSI_STRING ansi_str;
+ static const uint16_t PATTERN_LENGTH = 6;
BUS_ENTER( BUS_DBG_DRV );
-}
+ CL_ASSERT(pkey_array);
+ CL_ASSERT(str);
+ num_pKeys = 0;
+ cur_pkey_length = 0;
+
+ status =
RtlUnicodeStringToAnsiString(&ansi_str,str,TRUE);
+ if(! NT_SUCCESS(status))
+ {
+ BUS_TRACE(BUS_DBG_ERROR ,
+ ("RtlUnicodeStringToAnsiString returned
0x%.8x\n", status) );
+ return 0;
+ }
+
+ for (i = 0; (i < ansi_str.MaximumLength) &&
(num_pKeys < MAX_NUM_PKEY) ; i++)
+ {
+ switch(ansi_str.Buffer[i])
+ {
+ case '0':
+ cur_pkey_length++;
+ if (((i+1) < ansi_str.Length)
&& ( ( ansi_str.Buffer[i+1] == 'x') || ( ansi_str.Buffer[i+1] == 'X')))
+ break;
+ else
+ {
+
pkey_array[num_pKeys] = \
+
(pkey_array[num_pKeys] << 4)| 0;
+ break;
+ }
+
+ case 'x':
+ case 'X':
+ cur_pkey_length++;
+ break;
+
+ case ',':
+ if(cur_pkey_length ==
PATTERN_LENGTH)
+ {
+ cur_pkey_length =
0;
+ num_pKeys++;
+ }
+ break;
+
+ case 'A':
+ case 'a':
+ pkey_array[num_pKeys] = \
+ (pkey_array[num_pKeys] << 4)|
0xA;
+ cur_pkey_length++;
+ break;
+
+ case 'B':
+ case 'b':
+ pkey_array[num_pKeys] = \
+ (pkey_array[num_pKeys] << 4)|
0xB;
+ cur_pkey_length++;
+ break;
+
+ case 'C':
+ case 'c':
+ pkey_array[num_pKeys] = \
+ (pkey_array[num_pKeys] << 4)|
0xC;
+ cur_pkey_length++;
+ break;
+
+ case 'D':
+ case 'd':
+ pkey_array[num_pKeys] = \
+ (pkey_array[num_pKeys] << 4)|
0xD;
+ cur_pkey_length++;
+ break;
+
+ case 'E':
+ case 'e':
+ pkey_array[num_pKeys] = \
+ (pkey_array[num_pKeys] << 4)|
0xE;
+ cur_pkey_length++;
+ break;
+
+ case 'F':
+ case 'f':
+ pkey_array[num_pKeys] = \
+ (pkey_array[num_pKeys] << 4)|
0xF;
+ cur_pkey_length++;
+ break;
+
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ pkey_array[num_pKeys] = \
+ (pkey_array[num_pKeys] << 4)|
(ansi_str.Buffer[i] - '0');
+ cur_pkey_length++;
+ break;
+
+ case '\0':
+ if(cur_pkey_length ==
PATTERN_LENGTH)
+ {
+ cur_pkey_length =
0;
+ num_pKeys++;
+ }
+ else
+ {
+
RtlFreeAnsiString(&ansi_str);
+ return num_pKeys;
+ }
+ break;
+
+ default:
+ break;
+
+ }
+ }
+
+ RtlFreeAnsiString(&ansi_str);
+ BUS_EXIT( BUS_DBG_DRV );
+ return num_pKeys;
+}
static NTSTATUS
__read_registry(
IN
UNICODE_STRING* const p_registry_path )
{
NTSTATUS
status;
/* Remember the terminating entry in the table
below. */
- RTL_QUERY_REGISTRY_TABLE table[9];
+ RTL_QUERY_REGISTRY_TABLE table[10];
UNICODE_STRING
param_path;
+ UNICODE_STRING
pkeyString;
+ UNICODE_STRING
empy_string;
BUS_ENTER( BUS_DBG_DRV );
__read_machine_name();
+ RtlInitUnicodeString( &empy_string,NULL);
RtlInitUnicodeString( ¶m_path, NULL );
param_path.MaximumLength = p_registry_path->Length +
sizeof(L"\\Parameters");
@@ -212,7 +349,19 @@
RtlAppendUnicodeStringToString( ¶m_path,
p_registry_path );
RtlAppendUnicodeToString( ¶m_path,
L"\\Parameters" );
+ RtlInitUnicodeString( &pkeyString, NULL );
+ pkeyString.MaximumLength = 1024*sizeof(WCHAR);
+ pkeyString.Buffer = cl_zalloc( pkeyString.MaximumLength );
+ if( !pkeyString.Buffer )
+ {
+ cl_free(param_path.Buffer);
+ BUS_TRACE_EXIT( BUS_DBG_ERROR,
+ ("Failed to allocate parameters path
pkeyString.\n") );
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+ cl_memclr(&g_pkeys,sizeof(pkey_array_t));
+
/*
* Clear the table. This clears all the query
callback pointers,
* and sets up the terminating table entry.
@@ -277,10 +426,17 @@
table[7].DefaultData = &g_ioc_poll_interval;
table[7].DefaultLength = sizeof(ULONG);
+ table[8].Flags = RTL_QUERY_REGISTRY_DIRECT;
+ table[8].Name = L"PartitionKey";
+ table[8].EntryContext = &pkeyString;
+ table[8].DefaultType = REG_SZ;
+ table[8].DefaultData = &empy_string;
+ table[8].DefaultLength = 1024*sizeof(WCHAR);
/* Have at it! */
status = RtlQueryRegistryValues(
RTL_REGISTRY_ABSOLUTE,
param_path.Buffer, table, NULL, NULL );
-
+ if (NT_SUCCESS(status))
+ g_pkeys.pkey_num =
__prepare_pKey_array(&pkeyString, (uint16_t*)g_pkeys.pkey_array);
#if DBG
if( g_al_dbg_flags & AL_DBG_ERR )
g_al_dbg_flags |= CL_DBG_ERROR;
@@ -291,6 +447,7 @@
g_al_dbg_level,
g_al_dbg_flags));
+ cl_free( pkeyString.Buffer );
cl_free( param_path.Buffer );
BUS_EXIT( BUS_DBG_DRV );
return status;
@@ -419,7 +576,38 @@
return status;
}
+cl_status_t
+bus_add_pkey(cl_ioctl_handle_t
h_ioctl)
+{
+ cl_status_t
status;
+ pkey_array_t
*pkeys;
+ PIO_STACK_LOCATION
pIoStack;
+ BUS_ENTER( BUS_DBG_DRV );
+
+ pIoStack = IoGetCurrentIrpStackLocation(h_ioctl);
+ if ( (! h_ioctl->AssociatedIrp.SystemBuffer) ||
+
pIoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof
(pkey_array_t))
+ {
+ BUS_TRACE_EXIT( BUS_DBG_ERROR,
+ ("Invalid parameters.\n") );
+ return CL_INVALID_PARAMETER;
+ }
+
+ pkeys =
(pkey_array_t*)h_ioctl->AssociatedIrp.SystemBuffer;
+
+ /* create additional pdo */
+ status = port_mgr_pkey_add(pkeys);
+ if (! NT_SUCCESS(status))
+ {
+ BUS_TRACE_EXIT( BUS_DBG_ERROR,
+ ("port_mgr_pkey_add returned
%08x.\n", status) );
+ }
+
+ BUS_EXIT( BUS_DBG_DRV );
+ return status;
+}
+
static NTSTATUS
bus_drv_sysctl(
IN
DEVICE_OBJECT *p_dev_obj,
Index: core/bus/kernel/bus_pnp.h
===================================================================
--- core/bus/kernel/bus_pnp.h (revision 1081)
+++ core/bus/kernel/bus_pnp.h (working copy)
@@ -86,4 +86,5 @@
IN const net64_t
ca_guid,
IN IRP*
const p_irp );
+NTSTATUS port_mgr_pkey_add();
#endif // !defined _BUS_DRV_PNP_H_
Index: core/bus/kernel/bus_port_mgr.c
===================================================================
--- core/bus/kernel/bus_port_mgr.c (revision 1081)
+++ core/bus/kernel/bus_port_mgr.c (working copy)
@@ -42,8 +42,8 @@
#include <initguid.h>
#include <wdmguid.h>
#include "iba/ipoib_ifc.h"
+#include "al_dev.h"
-
#define IPOIB_DEVICE_ID
L"IBA\\IPoIB"
#define IPOIB_COMPAT_ID
L"IBA\\SID_1000066a00020000\0\0"
/* Hardware ID is a MULTI_SZ, so is terminated with a double
NULL. */
@@ -62,7 +62,7 @@
{
bus_pdo_ext_t pdo;
- net64_t
port_guid;
+ port_guid_pkey port_guid;
uint32_t n_port;
/* Number of references on the upper interface. */
@@ -73,7 +73,9 @@
port_mgr_t*
gp_port_mgr = NULL;
+extern pkey_array_t g_pkeys;
+static boolean_t pkeys_enumerated = FALSE;
/*
* Function prototypes.
*/
@@ -512,8 +514,7 @@
p_pdo_ext = PARENT_STRUCT( p_list_item,
bus_pdo_ext_t, list_item );
p_port_ext = (bus_port_ext_t*)p_pdo_ext;
- if( p_pdo_ext->b_present &&
p_pdo_ext->b_hibernating &&
- (p_port_ext->port_guid ==
p_pnp_rec->p_port_attr->port_guid) )
+ if( p_pdo_ext->b_present &&
p_pdo_ext->b_hibernating && (p_port_ext->port_guid.guid ==
p_pnp_rec->p_port_attr->port_guid))
{
n_devs++;
break;
@@ -523,7 +524,7 @@
("Skipped PDO for %s: PDO
%p, ext %p, present %d, missing %d, hibernating %d, port_guid %I64x.\n",
p_pdo_ext->cl_ext.vfptr_pnp_po->identity, p_pdo_ext->cl_ext.p_self_do,
p_pdo_ext,
p_pdo_ext->b_present, p_pdo_ext->b_reported_missing,
- p_pdo_ext->b_hibernating,
p_port_ext->port_guid ) );
+ p_pdo_ext->b_hibernating,
p_port_ext->port_guid.guid ) );
}
if (n_devs)
@@ -546,7 +547,7 @@
("Found PDO for
%s: PDO %p, ext %p, present %d, missing %d, hibernating %d, port_guid
%I64x.\n",
p_pdo_ext->cl_ext.vfptr_pnp_po->identity, p_pdo_ext->cl_ext.p_self_do,
p_pdo_ext,
p_pdo_ext->b_present, p_pdo_ext->b_reported_missing,
-
p_pdo_ext->b_hibernating, p_port_ext->port_guid ) );
+
p_pdo_ext->b_hibernating, p_port_ext->port_guid.guid ) );
}
}
else
@@ -567,9 +568,10 @@
IN
ib_pnp_port_rec_t* p_pnp_rec )
{
NTSTATUS status;
- DEVICE_OBJECT *p_pdo;
+ DEVICE_OBJECT *p_pdo[MAX_NUM_PKEY + 1];
+ uint8_t num_pdo;
bus_port_ext_t *p_port_ext;
-
+ ib_net16_t pdo_cnt;
BUS_ENTER( BUS_DBG_PNP );
if( !bus_globals.b_report_port_nic )
@@ -588,11 +590,20 @@
return status;
}
+ p_port_ext = NULL;
+
+ if( pkeys_enumerated)
+ pdo_cnt = 1;
+ else
+ pdo_cnt = g_pkeys.pkey_num + 1;
+
+ for (num_pdo = 0; num_pdo < pdo_cnt; num_pdo++)
+ {
/* Create the PDO for the new port device. */
status = IoCreateDevice( bus_globals.p_driver_obj,
sizeof(bus_port_ext_t),
NULL, FILE_DEVICE_CONTROLLER,
FILE_DEVICE_SECURE_OPEN |
FILE_AUTOGENERATED_DEVICE_NAME,
- FALSE, &p_pdo );
+ FALSE, &p_pdo[num_pdo] );
if( !NT_SUCCESS( status ) )
{
BUS_TRACE_EXIT( BUS_DBG_ERROR,
@@ -601,13 +612,13 @@
}
/* Initialize the device extension. */
- cl_init_pnp_po_ext( p_pdo, NULL, p_pdo,
bus_globals.dbg_lvl,
+ cl_init_pnp_po_ext( p_pdo[num_pdo], NULL,
p_pdo[num_pdo], bus_globals.dbg_lvl,
&vfptr_port_pnp, &vfptr_port_query_txt
);
/* Set the DO_BUS_ENUMERATED_DEVICE flag to mark it
as a PDO. */
- p_pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;
+ p_pdo[num_pdo]->Flags |=
DO_BUS_ENUMERATED_DEVICE;
- p_port_ext = p_pdo->DeviceExtension;
+ p_port_ext =
p_pdo[num_pdo]->DeviceExtension;
p_port_ext->pdo.dev_po_state.DeviceState =
PowerDeviceD0;
p_port_ext->pdo.p_parent_ext =
bus_globals.p_bus_ext;
p_port_ext->pdo.b_present = TRUE;
@@ -615,24 +626,34 @@
p_port_ext->pdo.b_hibernating = FALSE;
p_port_ext->pdo.p_po_work_item = NULL;
BUS_TRACE( BUS_DBG_PNP, ("Created device for %s: PDO
%p,ext %p, present %d, missing %d .\n",
-
p_port_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_pdo, p_port_ext,
p_port_ext->pdo.b_present,
+
p_port_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_pdo[num_pdo],
p_port_ext, p_port_ext->pdo.b_present,
p_port_ext->pdo.b_reported_missing ) );
/* Cache the CA GUID. */
p_port_ext->pdo.ca_guid =
p_pnp_rec->p_ca_attr->ca_guid;
/* Take a reference on the parent HCA. */
+ if(num_pdo > 0)
+ {
+ p_port_ext->pdo.h_ca =
((bus_port_ext_t*)p_pdo[0]->DeviceExtension)->pdo.h_ca;
+ }
+ else
p_port_ext->pdo.h_ca = acquire_ca(
p_pnp_rec->p_ca_attr->ca_guid );
if( !p_port_ext->pdo.h_ca )
{
- BUS_TRACE( BUS_DBG_PNP, ("Deleted
device: PDO %p\n", p_pdo ));
- IoDeleteDevice( p_pdo );
+ BUS_TRACE( BUS_DBG_PNP,
("Deleted device: PDO %p\n", p_pdo[num_pdo]));
+ IoDeleteDevice(
p_pdo[num_pdo]);
BUS_TRACE_EXIT( BUS_DBG_ERROR,
("acquire_ca failed to find CA.\n") );
return IB_INVALID_GUID;
}
- p_port_ext->port_guid =
p_pnp_rec->p_port_attr->port_guid;
+ p_port_ext->port_guid.guid =
p_pnp_rec->p_port_attr->port_guid;
p_port_ext->n_port =
p_pnp_rec->p_port_attr->port_num;
+ p_port_ext->port_guid.pkey =
IB_DEFAULT_PKEY;
+ if(num_pdo > 0)
+ {
+ p_port_ext->port_guid.pkey =
g_pkeys.pkey_array[num_pdo -1];
+ }
/* Store the device extension in the port vector for
future queries. */
cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
cl_qlist_insert_tail( &gp_port_mgr->port_list,
@@ -643,7 +664,10 @@
* Set the context of the PNP event. The context is
passed in for future
* events on the same port.
*/
- p_pnp_rec->pnp_rec.context = p_port_ext;
+ if(num_pdo == 0)
+ p_pnp_rec->pnp_rec.context =
p_port_ext;
+ }
+ pkeys_enumerated = TRUE;
/* Tell the PnP Manager to rescan for the HCA's bus
relations. */
IoInvalidateDeviceRelations(
@@ -657,7 +681,107 @@
return IB_SUCCESS;
}
+/**********************************************************************
**************
+* name : port_mgr_pkey_add
+* creates pdo for each pkey value in pkey_array
+* input : g_pkeys
+* output: none
+* return: cl_status
+***********************************************************************
**************/
+cl_status_t port_mgr_pkey_add(pkey_array_t *pkeys)
+{
+ uint16_t cnt;
+ NTSTATUS status;
+ cl_list_item_t *p_list_item;
+ bus_port_ext_t *p_port_ext,
*pkey_port_ext;
+ DEVICE_OBJECT *p_pdo[MAX_NUM_PKEY];
+ bus_pdo_ext_t *p_pdo_ext = NULL;
+ cl_qlist_t*
p_pdo_list = &gp_port_mgr->port_list;
+ BUS_ENTER( BUS_DBG_PNP );
+
+ p_port_ext = NULL;
+ cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
+
+ /* Count the number of child devices. */
+ for( p_list_item = cl_qlist_head( p_pdo_list );
+ p_list_item != cl_qlist_end( p_pdo_list
);
+ p_list_item = cl_qlist_next( p_list_item
) )
+ {
+ p_pdo_ext = PARENT_STRUCT( p_list_item,
bus_pdo_ext_t, list_item );
+ p_port_ext = (bus_port_ext_t*)p_pdo_ext;
+
+ if(p_port_ext->port_guid.pkey !=
IB_DEFAULT_PKEY)
+ break;
+ }
+ cl_mutex_release( &gp_port_mgr->pdo_mutex );
+
+ if (!p_port_ext)
+ {
+ BUS_TRACE_EXIT( BUS_DBG_ERROR,
+ ("No existed pdo found.\n")
);
+ return CL_ERROR;
+ }
+
+ for (cnt = 0; cnt < pkeys->pkey_num; cnt++)
+ {
+
+ /* Create the PDO for the new port
device. */
+ status = IoCreateDevice(
bus_globals.p_driver_obj, sizeof(bus_port_ext_t),
+ NULL, FILE_DEVICE_CONTROLLER,
+ FILE_DEVICE_SECURE_OPEN |
FILE_AUTOGENERATED_DEVICE_NAME,
+ FALSE, &p_pdo[cnt] );
+ if( !NT_SUCCESS( status ) )
+ {
+ BUS_TRACE_EXIT(
BUS_DBG_ERROR,
+ ("IoCreateDevice
returned %08x.\n", status) );
+ return CL_ERROR;
+ }
+
+ /* Initialize the device extension. */
+ cl_init_pnp_po_ext( p_pdo[cnt], NULL,
p_pdo[cnt], bus_globals.dbg_lvl,
+ &vfptr_port_pnp,
&vfptr_port_query_txt );
+
+ /* Set the DO_BUS_ENUMERATED_DEVICE flag
to mark it as a PDO. */
+ p_pdo[cnt]->Flags |=
DO_BUS_ENUMERATED_DEVICE;
+
+ pkey_port_ext =
p_pdo[cnt]->DeviceExtension;
+
pkey_port_ext->pdo.dev_po_state.DeviceState = PowerDeviceD0;
+ pkey_port_ext->pdo.p_parent_ext =
bus_globals.p_bus_ext;
+ pkey_port_ext->pdo.b_present = TRUE;
+ pkey_port_ext->pdo.b_reported_missing =
FALSE;
+ pkey_port_ext->pdo.b_hibernating = FALSE;
+ pkey_port_ext->pdo.p_po_work_item = NULL;
+ BUS_TRACE( BUS_DBG_PNP, ("Created device
for %s: PDO %p,ext %p, present %d, missing %d .\n",
+
pkey_port_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_pdo[cnt],
pkey_port_ext, pkey_port_ext->pdo.b_present,
+
pkey_port_ext->pdo.b_reported_missing ) );
+
+ /* Cache the CA GUID. */
+ pkey_port_ext->pdo.ca_guid =
p_port_ext->pdo.ca_guid;
+ pkey_port_ext->pdo.h_ca =
p_port_ext->pdo.h_ca;
+ pkey_port_ext->port_guid.guid =
p_port_ext->port_guid.guid;
+ pkey_port_ext->n_port =
p_port_ext->n_port;
+ pkey_port_ext->port_guid.pkey =
pkeys->pkey_array[cnt];
+
+ /* Store the device extension in the port
vector for future queries. */
+ cl_mutex_acquire( &gp_port_mgr->pdo_mutex
);
+ cl_qlist_insert_tail(
&gp_port_mgr->port_list,
+ &pkey_port_ext->pdo.list_item
);
+ cl_mutex_release( &gp_port_mgr->pdo_mutex
);
+ }
+
+ /* Tell the PnP Manager to rescan for the HCA's bus
relations. */
+ IoInvalidateDeviceRelations(
+
p_port_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );
+
+ /* Invalidate removal relations for the bus driver.
*/
+ IoInvalidateDeviceRelations(
+ bus_globals.p_bus_ext->cl_ext.p_pdo,
RemovalRelations );
+
+ BUS_EXIT( BUS_DBG_PNP );
+ return CL_SUCCESS;
+}
+
void
port_mgr_port_remove(
IN
ib_pnp_port_rec_t* p_pnp_rec )
@@ -1063,16 +1187,16 @@
}
/* The instance ID is the port GUID. */
- p_string = ExAllocatePoolWithTag( PagedPool,
sizeof(WCHAR) * 17, 'iuqp' );
+ p_string = ExAllocatePoolWithTag( PagedPool,
sizeof(WCHAR) * 21, 'iuqp' );
if( !p_string )
{
BUS_TRACE_EXIT( BUS_DBG_ERROR,
("Failed to allocate
instance ID buffer (%d bytes).\n",
- sizeof(WCHAR) * 17) );
+ sizeof(WCHAR) * 21) );
return STATUS_NO_MEMORY;
}
- status = RtlStringCchPrintfW( p_string, 17,
L"%016I64x", p_ext->port_guid );
+ status = RtlStringCchPrintfW( p_string, 21,
L"%016I64x%04x",p_ext->port_guid.guid,p_ext->port_guid.pkey );
if( !NT_SUCCESS( status ) )
{
CL_ASSERT( NT_SUCCESS( status ) );
Index: core/bus/kernel/ib_bus.inf
===================================================================
--- core/bus/kernel/ib_bus.inf (revision 1081)
+++ core/bus/kernel/ib_bus.inf (working copy)
@@ -183,6 +183,7 @@
HKR,"Parameters","IocQueryTimeout",%REG_DWORD_NO_CLOBBER%,250
HKR,"Parameters","IocQueryRetries",%REG_DWORD_NO_CLOBBER%,4
HKR,"Parameters","IocPollInterval",%REG_DWORD_NO_CLOBBER%,30000
+HKR,"Parameters","PartitionKey",%REG_SZ%,""
[Iou.ParamsReg]
HKR,"Parameters","DebugLevel",%REG_DWORD%,2
Index: inc/kernel/iba/ipoib_ifc.h
===================================================================
--- inc/kernel/iba/ipoib_ifc.h (revision 1081)
+++ inc/kernel/iba/ipoib_ifc.h (working copy)
@@ -60,6 +60,16 @@
* ipoib_ifc_data_t
*
* DESCRIPTION
+
+* The port guid combined from guid + PKEY
+*/
+typedef struct _port_guid_pkey
+{
+ net64_t guid;
+ ib_net16_t pkey;
+} port_guid_pkey;
+
+/*
* IPoIB interface datat.
*
* The ipoib_ifc_data_t structure
@@ -69,7 +79,7 @@
typedef struct _ipoib_ifc_data
{
net64_t
ca_guid;
- net64_t
port_guid;
+ port_guid_pkey
port_guid;
uint8_t
port_num;
} ipoib_ifc_data_t;
Index: tools/part_man/dirs
===================================================================
--- tools/part_man/dirs (revision 0)
+++ tools/part_man/dirs (revision 0)
@@ -0,0 +1,2 @@
+DIRS=\
+ user
Index: tools/part_man/dirs
===================================================================
--- tools/part_man/dirs (revision 0)
+++ tools/part_man/dirs (revision 0)
@@ -0,0 +1,2 @@
+DIRS=\
+ user
Index: tools/part_man/user/part_man.c
===================================================================
--- tools/part_man/user/part_man.c (revision 0)
+++ tools/part_man/user/part_man.c (revision 0)
@@ -0,0 +1,385 @@
+
+
+
+#include "stdio.h"
+#include "string.h"
+#include "stdlib.h"
+#include <windows.h>
+
+#include <iba/ib_types.h>
+#include <iba/ib_al.h>
+#include "al_dev.h"
+
+typedef enum
+{
+ pkey_show = 0,
+ pkey_add,
+ pkey_rem
+}Pkey_action;
+
+/* common query parameters */
+typedef struct _REQUEST_IN
+{
+ union
+ {
+ struct
+ {
+ unsigned short pkey_num;
+ unsigned __int16
pkeys[MAX_NUM_PKEY];
+ Pkey_action
action;
+ }guid_pkey;
+ }u;
+}REQUEST_IN;
+
+#define DEFAULT_BUFER_SIZE 1024
+static const char IBBUS_SERV_KEY[] =
{"SYSTEM\\CurrentControlSet\\Services\\ibbus\\Parameters"};
+
+void show_help()
+{
+ printf("Usage : part_man.exe <show|add|rem> <pkey1
pkey2 ...>\n");
+}
+
+/********************************************************************
+* name : reg_ibbus_pkey_show
+* read registry pkey and
optionally prints it
+* input : show - whether to print
+* output: partKey - contains read pkeys, reg_handle
+* return: number of characters read
+********************************************************************/
+static int reg_ibbus_pkey_show(IN BOOLEAN show,OUT char
*partKey, OUT HKEY *reg_handle)
+{
+ LONG ret;
+ int retval;
+ DWORD read_length = DEFAULT_BUFER_SIZE;
+
+ ret =
RegOpenKeyEx(HKEY_LOCAL_MACHINE,IBBUS_SERV_KEY,0,KEY_SET_VALUE |
KEY_QUERY_VALUE ,reg_handle);
+ if (ERROR_SUCCESS != ret)
+ {
+ printf("reg_ibbus_pkey_show error =
%d\n",GetLastError());
+ return 0;
+ }
+
+ do
+ {
+ ret =
RegQueryValueEx(*reg_handle,"PartitionKey",NULL,NULL,(LPBYTE)partKey,&re
ad_length);
+ if (ERROR_MORE_DATA == ret)
+ {
+ printf("reg_ibbus_pkey_show :
more buffer space required\n");
+ retval = 0;
+ break;
+ }
+
+ if (ERROR_SUCCESS != ret)
+ {
+ printf("RegQueryValueEx :
Error %d\n",ret);
+ retval = 0;
+ break;
+ }
+ retval = (int)read_length;
+ if(retval > 4)
+ {
+ if(show)
+ printf("Existed
Pkey(s): %s\n",partKey);
+ }
+ else
+ retval = 0;
+ }
+ while(FALSE);
+ return retval;
+}
+
+static boolean_t reg_ibbus_print_pkey()
+{
+ int result;
+ char pkeyBuf[DEFAULT_BUFER_SIZE];
+ HKEY hreg = NULL;
+
+ result =
reg_ibbus_pkey_show(TRUE,(char*)pkeyBuf,&hreg);
+ if(hreg)
+ RegCloseKey( hreg );
+
+ if (result < 4)
+ {
+ printf("No configured pkey found\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static int reg_ibbus_pkey_add(const uint16_t *pkeys, uint16_t
pkey_num,OUT pkey_array_t *pkey)
+{
+ char partKey[DEFAULT_BUFER_SIZE];
+ char tmp[10];
+ HKEY reg_handle;
+ LONG ret;
+ int cnt;
+ int retval = 0;
+ uint16_t i = 0;
+ DWORD read_length;
+
+ read_length =
reg_ibbus_pkey_show(FALSE,(char*)partKey,®_handle);
+
+ if (read_length < 4)
+ {
+ /* empty string read, simply write to
registry */
+ cnt = sprintf(partKey,"0x%04X",pkeys[0]);
+ pkey->pkey_array[pkey->pkey_num] =
pkeys[0];
+ pkey->pkey_num++;
+ i = 1;
+ }
+ else
+ {
+ /* update the existed registry list */
+ cnt = (int)strlen(partKey);
+ i = 0;
+ }
+
+ for ( ;i < pkey_num; i++)
+ {
+ sprintf(tmp,"0x%04X",pkeys[i]);
+ if (strstr(partKey,tmp))
+ {
+ continue;
+ }
+ pkey->pkey_array[pkey->pkey_num] =
pkeys[i];
+ pkey->pkey_num++;
+ cnt += sprintf(partKey +
cnt,",0x%04X",pkeys[i]);
+ }
+ cnt += sprintf(partKey + cnt,"\0");
+
+ if(pkey->pkey_num)
+ {
+ ret =
RegSetValueEx(reg_handle,"PartitionKey",0,REG_SZ,(BYTE*)partKey,
(DWORD)cnt);
+ if (ERROR_SUCCESS != ret)
+ {
+ printf("reg_ibbus_pkey_add
RegSetValueEx error = %d\n",GetLastError());
+ retval = 1;
+ }
+ }
+ else
+ printf("No pkey to add\n");
+ RegCloseKey( reg_handle );
+ return retval;
+}
+
+static int reg_ibbus_pkey_rem(const unsigned __int16 *pkeys,
unsigned short pkey_num,OUT pkey_array_t *pkey)
+{
+ char partKey[DEFAULT_BUFER_SIZE];
+ char newKey[DEFAULT_BUFER_SIZE] = {'\0'};
+
+ HKEY reg_handle;
+ LONG ret;
+ DWORD read_length;
+ int converted,cnt;
+ unsigned __int16 cur_pkey;
+ int retval = 0;
+ unsigned short i = 0;
+ char seps[] = ",";
+ char *token;
+ boolean_t found2remove;
+
+ read_length =
reg_ibbus_pkey_show(FALSE,(char*)partKey,®_handle);
+ do
+ {
+ if (read_length < 4)
+ {
+ /* empty string read, nothing
to delete */
+ printf("No pkey configured -
nothing to remove\n");
+ retval = 1;
+ break;
+ }
+
+ token = strtok(partKey,seps);
+ cnt = 0;
+ while(token)
+ {
+ found2remove = FALSE;
+ converted =
sscanf(token,"0x%X",&cur_pkey);
+ if(! converted || (converted
== EOF))
+ {
+ printf("invalid
registry format\n");
+ retval = 1;
+ break;
+ }
+ for (i = 0; i < pkey_num;
i++)
+ {
+ found2remove =
(boolean_t)(cur_pkey == pkeys[i]);
+ if(found2remove)
+
break;
+ }
+
+ if(found2remove)
+ {
+ pkey->pkey_num++;
+ }
+ else
+ {
+ if(!cnt)
+ cnt
+= sprintf(newKey + cnt,"0x%04X",cur_pkey);
+ else
+ cnt
+= sprintf(newKey + cnt,",0x%04X",cur_pkey);
+ }
+ token = strtok(NULL,seps);
+ }
+
+ if(! pkey->pkey_num)
+ {
+ /* nothing to delete */
+ printf("No pkey found to
remove\n");
+ retval = 1;
+ break;
+ }
+
+ ret =
RegSetValueEx(reg_handle,"PartitionKey",0,REG_SZ,(BYTE*)newKey,
(DWORD)strlen(newKey));
+ if (ERROR_SUCCESS != ret)
+ {
+ printf("reg_ibbus_pkey_add
RegSetValueEx error = %d\n",GetLastError());
+ retval = 1;
+ break;
+ }
+ }
+ while(FALSE);
+
+ RegCloseKey( reg_handle );
+ return retval;
+}
+
+int send_create_pdo_req(pkey_array_t *pkeys)
+{
+ HANDLE hKernelLib;
+ DWORD bytesReturned;
+
+ hKernelLib =
+ CreateFile(
+ "\\\\.\\ibal",
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, //
share mode none
+ NULL, // no
security
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL // no
template
+ );
+
+ if (hKernelLib == INVALID_HANDLE_VALUE)
+ {
+ printf("failed to open the kernel device
: error = %d\n",GetLastError());
+ return 1;
+ }
+
+ if (! DeviceIoControl(hKernelLib,
+
UAL_REQ_CREATE_PDO,
+
pkeys,sizeof(pkey_array_t),
+
NULL,0,
+
&bytesReturned,
+
NULL))
+ {
+ printf("send_create_pdo_req failed error
%d\n",GetLastError());
+ CloseHandle(hKernelLib);
+ return 1;
+ }
+ CloseHandle(hKernelLib);
+ return 0;
+}
+
+boolean_t reg_pkey_operation(const REQUEST_IN *input)
+{
+ pkey_array_t pkeys;
+ int result;
+ int i;
+ if(!input)
+ {
+ printf("create_ipoib_pdo : invalid input
parameter\n");
+ return FALSE;
+ }
+
+ RtlZeroMemory(&pkeys,sizeof(pkeys));
+ if(input->u.guid_pkey.action == pkey_add)
+ result = reg_ibbus_pkey_add((unsigned
__int16*)input->u.guid_pkey.pkeys, input->u.guid_pkey.pkey_num, &pkeys);
+ else if(input->u.guid_pkey.action == pkey_rem)
+ {
+ result = reg_ibbus_pkey_rem((unsigned
__int16*)input->u.guid_pkey.pkeys, input->u.guid_pkey.pkey_num, &pkeys);
+ return (boolean_t)(result == 0);
+ }
+ else if(input->u.guid_pkey.action == pkey_show)
+ return reg_ibbus_print_pkey();
+
+ if(0 == result)
+ {
+ if(pkeys.pkey_num)
+ return (boolean_t)( 0 ==
send_create_pdo_req(&pkeys));
+ }
+ return FALSE;
+}
+
+int prepare_reg_pkey_input(OUT REQUEST_IN *input,char*
cmd[],int num)
+{
+ int i;
+ input->u.guid_pkey.pkey_num = 0;
+
+ if(strstr(cmd[1],"add"))
+ input->u.guid_pkey.action = pkey_add;
+ else if(strstr(cmd[1],"rem"))
+ input->u.guid_pkey.action = pkey_rem;
+ else if(strstr(cmd[1],"show"))
+ {
+ input->u.guid_pkey.action = pkey_show;
+ return 1;
+ }
+ else
+ {
+ printf("invalid command %s\n",cmd[1]);
+ return 0;
+ }
+
+ if(num < 3)
+ {
+ printf("invalid command %s\n",cmd[1]);
+ return 0;
+ }
+ for( i = 2; i < num; i++)
+ {
+ if (strstr(cmd[i],"0x"))
+
sscanf(cmd[i],"0x%x",&input->u.guid_pkey.pkeys[input->u.guid_pkey.pkey_n
um]);
+ else
+
sscanf(cmd[i],"%x",&input->u.guid_pkey.pkeys[input->u.guid_pkey.pkey_num
]);
+
+ input->u.guid_pkey.pkey_num++;
+ }
+ return 1;
+}
+
+void partition_operation(char* cmd[],int num)
+{
+ REQUEST_IN input;
+
+ if (! prepare_reg_pkey_input(&input, cmd, num))
+ return;
+
+ if(! reg_pkey_operation(&input))
+ printf("Pkey operation failed\n");
+ else
+ printf("Done...\n");
+}
+
+int32_t __cdecl
+main(
+ int32_t argc,
+ char* argv[])
+{
+ BOOLEAN showHelp = FALSE;
+ if (argc < 2)
+ {
+ showHelp = TRUE;
+ }
+ else
+ {
+ if(!_stricmp(argv[1], "-h") ||
!_stricmp(argv[1], "-help"))
+ {
+ showHelp = TRUE;
+ }
+ else
+
partition_operation(argv,argc);
+ }
+ if (showHelp)
+ show_help();
+}
\ No newline at end of file
Index: tools/part_man/user/SOURCES
===================================================================
--- tools/part_man/user/SOURCES (revision 0)
+++ tools/part_man/user/SOURCES (revision 0)
@@ -0,0 +1,23 @@
+TARGETNAME=part_man
+TARGETPATH=..\..\..\bin\user\obj$(BUILD_ALT_DIR)
+TARGETTYPE=PROGRAM
+UMTYPE=console
+USE_CRTDLL=1
+
+SOURCES=part_man.c \
+ part_man.rc
+
+INCLUDES=..\..\..\inc;..\..\..\inc\user;..\..\..\core\al
+
+RCOPTIONS=/I..\..\win\include
+
+TARGETLIBS= \
+!if $(FREEBUILD)
+ $(TARGETPATH)\*\complib.lib \
+ $(TARGETPATH)\*\ibal.lib
+!else
+ $(TARGETPATH)\*\complibd.lib
\
+ $(TARGETPATH)\*\ibald.lib
+!endif
+
+MSC_WARNING_LEVEL= /W3
Index: tools/part_man/user/part_man.rc
===================================================================
--- tools/part_man/user/part_man.rc (revision 0)
+++ tools/part_man/user/part_man.rc (revision 0)
@@ -0,0 +1,18 @@
+
+
+
+#include <oib_ver.h>
+
+#define VER_FILETYPE
VFT_APP
+#define VER_FILESUBTYPE
VFT2_UNKNOWN
+
+#ifdef _DEBUG_
+#define VER_FILEDESCRIPTION_STR "Partition manager
application(Debug)"
+#else
+#define VER_FILEDESCRIPTION_STR "Partition manager
application"
+#endif
+
+#define VER_INTERNALNAME_STR "part_man.exe"
+#define VER_ORIGINALFILENAME_STR "part_man.exe"
+
+#include <common.ver>
Index: tools/part_man/user/makefile
===================================================================
--- tools/part_man/user/makefile (revision 0)
+++ tools/part_man/user/makefile (revision 0)
@@ -0,0 +1,7 @@
+#
+# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add
a new source
+# file to this component. This file merely indirects to the
real make file
+# that is shared by all the driver components of the OpenIB
Windows project.
+#
+
+!INCLUDE ..\..\..\inc\openib.def
Index: tools/part_man/user/makefile
===================================================================
--- tools/part_man/user/makefile (revision 0)
+++ tools/part_man/user/makefile (revision 0)
@@ -0,0 +1,7 @@
+#
+# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add
a new source
+# file to this component. This file merely indirects to the
real make file
+# that is shared by all the driver components of the OpenIB
Windows project.
+#
+
+!INCLUDE ..\..\..\inc\openib.def
Index: tools/part_man/user/part_man.c
===================================================================
--- tools/part_man/user/part_man.c (revision 0)
+++ tools/part_man/user/part_man.c (revision 0)
@@ -0,0 +1,385 @@
+
+
+
+#include "stdio.h"
+#include "string.h"
+#include "stdlib.h"
+#include <windows.h>
+
+#include <iba/ib_types.h>
+#include <iba/ib_al.h>
+#include "al_dev.h"
+
+typedef enum
+{
+ pkey_show = 0,
+ pkey_add,
+ pkey_rem
+}Pkey_action;
+
+/* common query parameters */
+typedef struct _REQUEST_IN
+{
+ union
+ {
+ struct
+ {
+ unsigned short pkey_num;
+ unsigned __int16
pkeys[MAX_NUM_PKEY];
+ Pkey_action
action;
+ }guid_pkey;
+ }u;
+}REQUEST_IN;
+
+#define DEFAULT_BUFER_SIZE 1024
+static const char IBBUS_SERV_KEY[] =
{"SYSTEM\\CurrentControlSet\\Services\\ibbus\\Parameters"};
+
+void show_help()
+{
+ printf("Usage : part_man.exe <show|add|rem> <pkey1
pkey2 ...>\n");
+}
+
+/********************************************************************
+* name : reg_ibbus_pkey_show
+* read registry pkey and
optionally prints it
+* input : show - whether to print
+* output: partKey - contains read pkeys, reg_handle
+* return: number of characters read
+********************************************************************/
+static int reg_ibbus_pkey_show(IN BOOLEAN show,OUT char
*partKey, OUT HKEY *reg_handle)
+{
+ LONG ret;
+ int retval;
+ DWORD read_length = DEFAULT_BUFER_SIZE;
+
+ ret =
RegOpenKeyEx(HKEY_LOCAL_MACHINE,IBBUS_SERV_KEY,0,KEY_SET_VALUE |
KEY_QUERY_VALUE ,reg_handle);
+ if (ERROR_SUCCESS != ret)
+ {
+ printf("reg_ibbus_pkey_show error =
%d\n",GetLastError());
+ return 0;
+ }
+
+ do
+ {
+ ret =
RegQueryValueEx(*reg_handle,"PartitionKey",NULL,NULL,(LPBYTE)partKey,&re
ad_length);
+ if (ERROR_MORE_DATA == ret)
+ {
+ printf("reg_ibbus_pkey_show :
more buffer space required\n");
+ retval = 0;
+ break;
+ }
+
+ if (ERROR_SUCCESS != ret)
+ {
+ printf("RegQueryValueEx :
Error %d\n",ret);
+ retval = 0;
+ break;
+ }
+ retval = (int)read_length;
+ if(retval > 4)
+ {
+ if(show)
+ printf("Existed
Pkey(s): %s\n",partKey);
+ }
+ else
+ retval = 0;
+ }
+ while(FALSE);
+ return retval;
+}
+
+static boolean_t reg_ibbus_print_pkey()
+{
+ int result;
+ char pkeyBuf[DEFAULT_BUFER_SIZE];
+ HKEY hreg = NULL;
+
+ result =
reg_ibbus_pkey_show(TRUE,(char*)pkeyBuf,&hreg);
+ if(hreg)
+ RegCloseKey( hreg );
+
+ if (result < 4)
+ {
+ printf("No configured pkey found\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static int reg_ibbus_pkey_add(const uint16_t *pkeys, uint16_t
pkey_num,OUT pkey_array_t *pkey)
+{
+ char partKey[DEFAULT_BUFER_SIZE];
+ char tmp[10];
+ HKEY reg_handle;
+ LONG ret;
+ int cnt;
+ int retval = 0;
+ uint16_t i = 0;
+ DWORD read_length;
+
+ read_length =
reg_ibbus_pkey_show(FALSE,(char*)partKey,®_handle);
+
+ if (read_length < 4)
+ {
+ /* empty string read, simply write to
registry */
+ cnt = sprintf(partKey,"0x%04X",pkeys[0]);
+ pkey->pkey_array[pkey->pkey_num] =
pkeys[0];
+ pkey->pkey_num++;
+ i = 1;
+ }
+ else
+ {
+ /* update the existed registry list */
+ cnt = (int)strlen(partKey);
+ i = 0;
+ }
+
+ for ( ;i < pkey_num; i++)
+ {
+ sprintf(tmp,"0x%04X",pkeys[i]);
+ if (strstr(partKey,tmp))
+ {
+ continue;
+ }
+ pkey->pkey_array[pkey->pkey_num] =
pkeys[i];
+ pkey->pkey_num++;
+ cnt += sprintf(partKey +
cnt,",0x%04X",pkeys[i]);
+ }
+ cnt += sprintf(partKey + cnt,"\0");
+
+ if(pkey->pkey_num)
+ {
+ ret =
RegSetValueEx(reg_handle,"PartitionKey",0,REG_SZ,(BYTE*)partKey,
(DWORD)cnt);
+ if (ERROR_SUCCESS != ret)
+ {
+ printf("reg_ibbus_pkey_add
RegSetValueEx error = %d\n",GetLastError());
+ retval = 1;
+ }
+ }
+ else
+ printf("No pkey to add\n");
+ RegCloseKey( reg_handle );
+ return retval;
+}
+
+static int reg_ibbus_pkey_rem(const unsigned __int16 *pkeys,
unsigned short pkey_num,OUT pkey_array_t *pkey)
+{
+ char partKey[DEFAULT_BUFER_SIZE];
+ char newKey[DEFAULT_BUFER_SIZE] = {'\0'};
+
+ HKEY reg_handle;
+ LONG ret;
+ DWORD read_length;
+ int converted,cnt;
+ unsigned __int16 cur_pkey;
+ int retval = 0;
+ unsigned short i = 0;
+ char seps[] = ",";
+ char *token;
+ boolean_t found2remove;
+
+ read_length =
reg_ibbus_pkey_show(FALSE,(char*)partKey,®_handle);
+ do
+ {
+ if (read_length < 4)
+ {
+ /* empty string read, nothing
to delete */
+ printf("No pkey configured -
nothing to remove\n");
+ retval = 1;
+ break;
+ }
+
+ token = strtok(partKey,seps);
+ cnt = 0;
+ while(token)
+ {
+ found2remove = FALSE;
+ converted =
sscanf(token,"0x%X",&cur_pkey);
+ if(! converted || (converted
== EOF))
+ {
+ printf("invalid
registry format\n");
+ retval = 1;
+ break;
+ }
+ for (i = 0; i < pkey_num;
i++)
+ {
+ found2remove =
(boolean_t)(cur_pkey == pkeys[i]);
+ if(found2remove)
+
break;
+ }
+
+ if(found2remove)
+ {
+ pkey->pkey_num++;
+ }
+ else
+ {
+ if(!cnt)
+ cnt
+= sprintf(newKey + cnt,"0x%04X",cur_pkey);
+ else
+ cnt
+= sprintf(newKey + cnt,",0x%04X",cur_pkey);
+ }
+ token = strtok(NULL,seps);
+ }
+
+ if(! pkey->pkey_num)
+ {
+ /* nothing to delete */
+ printf("No pkey found to
remove\n");
+ retval = 1;
+ break;
+ }
+
+ ret =
RegSetValueEx(reg_handle,"PartitionKey",0,REG_SZ,(BYTE*)newKey,
(DWORD)strlen(newKey));
+ if (ERROR_SUCCESS != ret)
+ {
+ printf("reg_ibbus_pkey_add
RegSetValueEx error = %d\n",GetLastError());
+ retval = 1;
+ break;
+ }
+ }
+ while(FALSE);
+
+ RegCloseKey( reg_handle );
+ return retval;
+}
+
+int send_create_pdo_req(pkey_array_t *pkeys)
+{
+ HANDLE hKernelLib;
+ DWORD bytesReturned;
+
+ hKernelLib =
+ CreateFile(
+ "\\\\.\\ibal",
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, //
share mode none
+ NULL, // no
security
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL // no
template
+ );
+
+ if (hKernelLib == INVALID_HANDLE_VALUE)
+ {
+ printf("failed to open the kernel device
: error = %d\n",GetLastError());
+ return 1;
+ }
+
+ if (! DeviceIoControl(hKernelLib,
+
UAL_REQ_CREATE_PDO,
+
pkeys,sizeof(pkey_array_t),
+
NULL,0,
+
&bytesReturned,
+
NULL))
+ {
+ printf("send_create_pdo_req failed error
%d\n",GetLastError());
+ CloseHandle(hKernelLib);
+ return 1;
+ }
+ CloseHandle(hKernelLib);
+ return 0;
+}
+
+boolean_t reg_pkey_operation(const REQUEST_IN *input)
+{
+ pkey_array_t pkeys;
+ int result;
+ int i;
+ if(!input)
+ {
+ printf("create_ipoib_pdo : invalid input
parameter\n");
+ return FALSE;
+ }
+
+ RtlZeroMemory(&pkeys,sizeof(pkeys));
+ if(input->u.guid_pkey.action == pkey_add)
+ result = reg_ibbus_pkey_add((unsigned
__int16*)input->u.guid_pkey.pkeys, input->u.guid_pkey.pkey_num, &pkeys);
+ else if(input->u.guid_pkey.action == pkey_rem)
+ {
+ result = reg_ibbus_pkey_rem((unsigned
__int16*)input->u.guid_pkey.pkeys, input->u.guid_pkey.pkey_num, &pkeys);
+ return (boolean_t)(result == 0);
+ }
+ else if(input->u.guid_pkey.action == pkey_show)
+ return reg_ibbus_print_pkey();
+
+ if(0 == result)
+ {
+ if(pkeys.pkey_num)
+ return (boolean_t)( 0 ==
send_create_pdo_req(&pkeys));
+ }
+ return FALSE;
+}
+
+int prepare_reg_pkey_input(OUT REQUEST_IN *input,char*
cmd[],int num)
+{
+ int i;
+ input->u.guid_pkey.pkey_num = 0;
+
+ if(strstr(cmd[1],"add"))
+ input->u.guid_pkey.action = pkey_add;
+ else if(strstr(cmd[1],"rem"))
+ input->u.guid_pkey.action = pkey_rem;
+ else if(strstr(cmd[1],"show"))
+ {
+ input->u.guid_pkey.action = pkey_show;
+ return 1;
+ }
+ else
+ {
+ printf("invalid command %s\n",cmd[1]);
+ return 0;
+ }
+
+ if(num < 3)
+ {
+ printf("invalid command %s\n",cmd[1]);
+ return 0;
+ }
+ for( i = 2; i < num; i++)
+ {
+ if (strstr(cmd[i],"0x"))
+
sscanf(cmd[i],"0x%x",&input->u.guid_pkey.pkeys[input->u.guid_pkey.pkey_n
um]);
+ else
+
sscanf(cmd[i],"%x",&input->u.guid_pkey.pkeys[input->u.guid_pkey.pkey_num
]);
+
+ input->u.guid_pkey.pkey_num++;
+ }
+ return 1;
+}
+
+void partition_operation(char* cmd[],int num)
+{
+ REQUEST_IN input;
+
+ if (! prepare_reg_pkey_input(&input, cmd, num))
+ return;
+
+ if(! reg_pkey_operation(&input))
+ printf("Pkey operation failed\n");
+ else
+ printf("Done...\n");
+}
+
+int32_t __cdecl
+main(
+ int32_t argc,
+ char* argv[])
+{
+ BOOLEAN showHelp = FALSE;
+ if (argc < 2)
+ {
+ showHelp = TRUE;
+ }
+ else
+ {
+ if(!_stricmp(argv[1], "-h") ||
!_stricmp(argv[1], "-help"))
+ {
+ showHelp = TRUE;
+ }
+ else
+
partition_operation(argv,argc);
+ }
+ if (showHelp)
+ show_help();
+}
\ No newline at end of file
Index: tools/part_man/user/part_man.rc
===================================================================
--- tools/part_man/user/part_man.rc (revision 0)
+++ tools/part_man/user/part_man.rc (revision 0)
@@ -0,0 +1,18 @@
+
+
+
+#include <oib_ver.h>
+
+#define VER_FILETYPE
VFT_APP
+#define VER_FILESUBTYPE
VFT2_UNKNOWN
+
+#ifdef _DEBUG_
+#define VER_FILEDESCRIPTION_STR "Partition manager
application(Debug)"
+#else
+#define VER_FILEDESCRIPTION_STR "Partition manager
application"
+#endif
+
+#define VER_INTERNALNAME_STR "part_man.exe"
+#define VER_ORIGINALFILENAME_STR "part_man.exe"
+
+#include <common.ver>
Index: tools/part_man/user/SOURCES
===================================================================
--- tools/part_man/user/SOURCES (revision 0)
+++ tools/part_man/user/SOURCES (revision 0)
@@ -0,0 +1,23 @@
+TARGETNAME=part_man
+TARGETPATH=..\..\..\bin\user\obj$(BUILD_ALT_DIR)
+TARGETTYPE=PROGRAM
+UMTYPE=console
+USE_CRTDLL=1
+
+SOURCES=part_man.c \
+ part_man.rc
+
+INCLUDES=..\..\..\inc;..\..\..\inc\user;..\..\..\core\al
+
+RCOPTIONS=/I..\..\win\include
+
+TARGETLIBS= \
+!if $(FREEBUILD)
+ $(TARGETPATH)\*\complib.lib \
+ $(TARGETPATH)\*\ibal.lib
+!else
+ $(TARGETPATH)\*\complibd.lib
\
+ $(TARGETPATH)\*\ibald.lib
+!endif
+
+MSC_WARNING_LEVEL= /W3
Index: ulp/ipoib/kernel/ipoib_adapter.c
===================================================================
--- ulp/ipoib/kernel/ipoib_adapter.c (revision 1081)
+++ ulp/ipoib/kernel/ipoib_adapter.c (working copy)
@@ -171,7 +171,7 @@
IPOIB_PRINT( TRACE_LEVEL_INFORMATION,
IPOIB_DBG_INIT,
("Port %016I64x (CA %016I64x
port %d) initializing\n",
- p_adapter->guids.port_guid,
p_adapter->guids.ca_guid,
+
p_adapter->guids.port_guid.guid, p_adapter->guids.ca_guid,
p_adapter->guids.port_num)
);
cl_status = cl_obj_init( &p_adapter->obj,
CL_DESTROY_SYNC,
@@ -343,7 +343,7 @@
/* Validate the port GUID and generate the MAC
address. */
status =
- ipoib_mac_from_guid(
p_adapter->guids.port_guid, &p_adapter->mac );
+ ipoib_mac_from_guid(
p_adapter->guids.port_guid.guid, &p_adapter->mac );
if( status != IB_SUCCESS )
{
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR,
IPOIB_DBG_ERROR,
@@ -530,7 +530,7 @@
case IB_PNP_PORT_ADD:
CL_ASSERT( !p_pnp_rec->context );
/* Only process our port GUID. */
- if( p_pnp_rec->guid !=
p_adapter->guids.port_guid )
+ if( p_pnp_rec->guid !=
p_adapter->guids.port_guid.guid )
{
status = IB_NOT_DONE;
break;
Index: ulp/ipoib/kernel/ipoib_driver.c
===================================================================
--- ulp/ipoib/kernel/ipoib_driver.c (revision 1081)
+++ ulp/ipoib/kernel/ipoib_driver.c (working copy)
@@ -767,7 +767,7 @@
IPOIB_PRINT( TRACE_LEVEL_INFORMATION,
IPOIB_DBG_INIT,
("Port %016I64x (CA %016I64x
port %d) halting\n",
- p_adapter->guids.port_guid,
p_adapter->guids.ca_guid,
+
p_adapter->guids.port_guid.guid, p_adapter->guids.ca_guid,
p_adapter->guids.port_num)
);
ipoib_destroy_adapter( p_adapter );
@@ -2330,13 +2330,19 @@
IPOIB_ENTER( IPOIB_DBG_OID );
+ if(p_adapter->guids.port_guid.pkey !=
IB_DEFAULT_PKEY)
+ {
+ IPOIB_PRINT_EXIT(
TRACE_LEVEL_ERROR,IPOIB_DBG_ERROR,
+ ("ATS Service available for default pkey
only\n"));
+ return;
+ }
port_num = p_adapter->guids.port_num;
/* Setup our service call with things common to all
calls */
cl_memset( &ib_service, 0, sizeof(ib_service) );
/* BUGBUG Only register local subnet GID prefix for
now */
- ib_gid_set_default( &port_gid,
p_adapter->guids.port_guid );
+ ib_gid_set_default( &port_gid,
p_adapter->guids.port_guid.guid );
ib_service.svc_rec.service_gid =
port_gid;
ib_service.svc_rec.service_pkey =
IB_DEFAULT_PKEY;
@@ -2347,7 +2353,7 @@
strcpy( (char *)ib_service.svc_rec.service_name,
ATS_NAME );
/* IP Address in question will be put in below */
- ib_service.port_guid =
p_adapter->guids.port_guid;
+ ib_service.port_guid =
p_adapter->guids.port_guid.guid;
ib_service.timeout_ms =
p_adapter->params.sa_timeout;
ib_service.retry_cnt =
p_adapter->params.sa_retry_cnt;
Index: ulp/ipoib/kernel/ipoib_endpoint.c
===================================================================
--- ulp/ipoib/kernel/ipoib_endpoint.c (revision 1081)
+++ ulp/ipoib/kernel/ipoib_endpoint.c (working copy)
@@ -312,13 +312,13 @@
cl_memclr( &path, sizeof(ib_path_rec_t) );
path.dgid = p_endpt->dgid;
- ib_gid_set_default( &path.sgid,
p_port->p_adapter->guids.port_guid );
+ ib_gid_set_default( &path.sgid,
p_port->p_adapter->guids.port_guid.guid );
path.num_path = 0x1;
cl_memclr( &query, sizeof(ib_query_req_t) );
query.query_type = IB_QUERY_USER_DEFINED;
query.p_query_input = &info;
- query.port_guid =
p_port->p_adapter->guids.port_guid;
+ query.port_guid =
p_port->p_adapter->guids.port_guid.guid;
query.timeout_ms =
p_port->p_adapter->params.sa_timeout;
query.retry_cnt =
p_port->p_adapter->params.sa_retry_cnt;
Index: ulp/ipoib/kernel/ipoib_ibat.c
===================================================================
--- ulp/ipoib/kernel/ipoib_ibat.c (revision 1081)
+++ ulp/ipoib/kernel/ipoib_ibat.c (working copy)
@@ -140,7 +140,7 @@
{
pAdapter = CONTAINING_RECORD( pItem,
ipoib_adapter_t, entry );
pOut->Ports[pOut->NumPorts].CaGuid =
pAdapter->guids.ca_guid;
- pOut->Ports[pOut->NumPorts].PortGuid =
pAdapter->guids.port_guid;
+ pOut->Ports[pOut->NumPorts].PortGuid =
pAdapter->guids.port_guid.guid;
pOut->Ports[pOut->NumPorts].PortNum =
pAdapter->guids.port_num;
pOut->NumPorts++;
@@ -210,7 +210,7 @@
pItem = cl_qlist_next( pItem ) )
{
pAdapter = CONTAINING_RECORD( pItem,
ipoib_adapter_t, entry );
- if( PortGuid &&
pAdapter->guids.port_guid != PortGuid )
+ if( PortGuid &&
pAdapter->guids.port_guid.guid != PortGuid )
continue;
cl_obj_lock( &pAdapter->obj );
@@ -300,7 +300,7 @@
pItem = cl_qlist_next( pItem ) )
{
pAdapter = CONTAINING_RECORD( pItem,
ipoib_adapter_t, entry );
- if( pIn->PortGuid !=
pAdapter->guids.port_guid )
+ if( pIn->PortGuid !=
pAdapter->guids.port_guid.guid )
continue;
/* Found the port - lookup the MAC. */
@@ -394,7 +394,7 @@
if (!memcmp(
&pIn->Address.Address[12], pAddr->address.as_bytes, IPV4_ADDR_SIZE))
{
pOut->Port.CaGuid = pAdapter->guids.ca_guid;
-
pOut->Port.PortGuid = pAdapter->guids.port_guid;
+
pOut->Port.PortGuid = pAdapter->guids.port_guid.guid;
pOut->Port.PortNum = pAdapter->guids.port_num;
pIrp->IoStatus.Information = sizeof(IOCTL_IBAT_IP_TO_PORT_OUT);
status =
STATUS_SUCCESS;
Index: ulp/ipoib/kernel/ipoib_port.c
===================================================================
--- ulp/ipoib/kernel/ipoib_port.c (revision 1081)
+++ ulp/ipoib/kernel/ipoib_port.c (working copy)
@@ -793,6 +793,8 @@
uint64_t vaddr;
net32_t rkey;
ib_qp_attr_t qp_attr;
+ ib_ca_attr_t *ca_attr;
+ uint32_t ca_size;
IPOIB_ENTER( IPOIB_DBG_INIT );
@@ -810,6 +812,51 @@
return status;
}
+ /* Query the CA for Pkey table */
+ status =
p_port->p_adapter->p_ifc->query_ca(p_port->ib_mgr.h_ca, NULL, &ca_size);
+ if(status != IB_INSUFFICIENT_MEMORY)
+ {
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR,
IPOIB_DBG_ERROR,
+ ("ib_query_ca failed\n"));
+ return status;
+ }
+
+ ca_attr = (ib_ca_attr_t*)cl_zalloc(ca_size);
+ if (!ca_attr)
+ {
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR,
IPOIB_DBG_ERROR,
+ ("cl_zalloc can't allocate
%d\n",ca_size));
+ return IB_INSUFFICIENT_RESOURCES;
+ }
+
+ status =
p_port->p_adapter->p_ifc->query_ca(p_port->ib_mgr.h_ca,
ca_attr,&ca_size);
+ if( status != IB_SUCCESS )
+ {
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR,
IPOIB_DBG_ERROR,
+ ("ib_query_ca returned %s\n",
+
p_port->p_adapter->p_ifc->get_err_str( status )) );
+ return status;
+ }
+ if( ca_attr->p_port_attr->link_state ==
IB_LINK_ACTIVE)
+ {
+ uint16_t index;
+
CL_ASSERT(ca_attr->p_port_attr->p_pkey_table[0] == IB_DEFAULT_PKEY);
+ for(index = 0; index <
ca_attr->p_port_attr->num_pkeys; index++)
+ {
+
if(p_port->p_adapter->guids.port_guid.pkey ==
ca_attr->p_port_attr->p_pkey_table[index])
+ break;
+ }
+ if(index >=
ca_attr->p_port_attr->num_pkeys)
+ {
+ IPOIB_PRINT_EXIT(
TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
+ ("Pkey table is invalid,
index not found\n"));
+ return IB_NOT_FOUND;
+ }
+ p_port->pkey_index = index;
+ IPOIB_PRINT_EXIT(
TRACE_LEVEL_INFORMATION, IPOIB_DBG_IB,
+ ("for PKEY = 0x%04X got index
= %d\n",p_port->p_adapter->guids.port_guid.pkey,index));
+ }
+ cl_free(ca_attr);
/* Allocate the PD. */
status = p_port->p_adapter->p_ifc->alloc_pd(
p_port->ib_mgr.h_ca, IB_PDT_UD, p_port,
&p_port->ib_mgr.h_pd );
@@ -3309,7 +3356,7 @@
CL_ASSERT( p_cid[1] == 21 );
p_cid[23]= DHCP_OPT_END;
- ib_gid_set_default( &gid,
p_port->p_adapter->guids.port_guid );
+ ib_gid_set_default( &gid,
p_port->p_adapter->guids.port_guid.guid );
cl_memcpy( &p_cid[7], &gid,
sizeof(ib_gid_t) );
cl_memcpy( &p_cid[3],
&p_port->ib_mgr.qpn, sizeof(p_port->ib_mgr.qpn) );
p_ib_dhcp->htype = DHCP_HW_TYPE_IB;
@@ -3409,7 +3456,7 @@
p_ib_arp->op = p_arp->op;
p_ib_arp->src_hw.flags_qpn = p_port->ib_mgr.qpn;
ib_gid_set_default( &p_ib_arp->src_hw.gid,
- p_port->p_adapter->guids.port_guid );
+ p_port->p_adapter->guids.port_guid.guid
);
p_ib_arp->src_ip = p_arp->src_ip;
if( cl_memcmp( &p_arp->dst_hw, &null_hw,
sizeof(mac_addr_t) ) )
{
@@ -3584,7 +3631,7 @@
p_desc->wr.dgrm.ud.remote_qp = p_desc->p_endpt->qpn;
p_desc->wr.dgrm.ud.remote_qkey =
p_port->ib_mgr.bcast_rec.qkey;
p_desc->wr.dgrm.ud.h_av = p_desc->p_endpt->h_av;
- p_desc->wr.dgrm.ud.pkey_index = 0;
+ p_desc->wr.dgrm.ud.pkey_index = p_port->pkey_index;
p_desc->wr.dgrm.ud.rsvd = NULL;
/* Store context in our reserved area of the packet.
*/
@@ -4683,7 +4730,7 @@
cl_memclr( &query, sizeof(ib_query_req_t) );
query.query_type = IB_QUERY_USER_DEFINED;
query.p_query_input = &info;
- query.port_guid =
p_port->p_adapter->guids.port_guid;
+ query.port_guid =
p_port->p_adapter->guids.port_guid.guid;
query.timeout_ms =
p_port->p_adapter->params.sa_timeout;
query.retry_cnt =
p_port->p_adapter->params.sa_retry_cnt;
query.query_context = p_port;
@@ -4721,7 +4768,7 @@
IPOIB_ENTER( IPOIB_DBG_INIT );
- ib_gid_set_default( &gid,
p_port->p_adapter->guids.port_guid );
+ ib_gid_set_default( &gid,
p_port->p_adapter->guids.port_guid.guid );
p_endpt = ipoib_endpt_create(
&gid, p_port_info->base_lid,
p_port->ib_mgr.qpn );
if( !p_endpt )
@@ -4894,10 +4941,13 @@
cl_memclr( &member_rec, sizeof(ib_member_rec_t) );
member_rec.mgid = bcast_mgid_template;
+ member_rec.mgid.raw[4] = (uint8_t)
p_port->p_adapter->guids.port_guid.pkey ;
+ member_rec.mgid.raw[5] = (uint8_t)
(p_port->p_adapter->guids.port_guid.pkey >> 8);
+ member_rec.pkey =
p_port->p_adapter->guids.port_guid.pkey;
cl_memclr( &query, sizeof(ib_query_req_t) );
query.query_type = IB_QUERY_USER_DEFINED;
query.p_query_input = &info;
- query.port_guid =
p_port->p_adapter->guids.port_guid;
+ query.port_guid =
p_port->p_adapter->guids.port_guid.guid;
query.timeout_ms =
p_port->p_adapter->params.sa_timeout;
query.retry_cnt =
p_port->p_adapter->params.sa_retry_cnt;
query.query_context = p_port;
@@ -5031,14 +5081,14 @@
/* We specify our port GID for the join operation.
*/
mcast_req.member_rec.port_gid.unicast.prefix =
IB_DEFAULT_SUBNET_PREFIX;
mcast_req.member_rec.port_gid.unicast.interface_id =
- p_port->p_adapter->guids.port_guid;
+ p_port->p_adapter->guids.port_guid.guid;
mcast_req.mcast_context = p_port;
mcast_req.pfn_mcast_cb = __bcast_cb;
mcast_req.timeout_ms =
p_port->p_adapter->params.sa_timeout;
mcast_req.retry_cnt =
p_port->p_adapter->params.sa_retry_cnt;
- mcast_req.port_guid =
p_port->p_adapter->guids.port_guid;
- mcast_req.pkey_index = 0;
+ mcast_req.port_guid =
p_port->p_adapter->guids.port_guid.guid;
+ mcast_req.pkey_index = p_port->pkey_index;
if( ib_member_get_state(
mcast_req.member_rec.scope_state ) !=
IB_MC_REC_STATE_FULL_MEMBER )
@@ -5085,8 +5135,10 @@
* We specify the MGID since we don't want the SA to
generate it for us.
*/
mcast_req.member_rec.mgid = bcast_mgid_template;
+ mcast_req.member_rec.mgid.raw[4] = (uint8_t)
p_port->p_adapter->guids.port_guid.pkey;
+ mcast_req.member_rec.mgid.raw[5] = (uint8_t)
(p_port->p_adapter->guids.port_guid.pkey >> 8);
ib_gid_set_default( &mcast_req.member_rec.port_gid,
- p_port->p_adapter->guids.port_guid );
+ p_port->p_adapter->guids.port_guid.guid
);
/*
* IPOIB spec requires that the QKEY have the MSb
set so that the QKEY
* from the QP is used rather than the QKEY in the
send WR.
@@ -5096,7 +5148,7 @@
mcast_req.member_rec.mtu =
(IB_PATH_SELECTOR_EXACTLY << 6) |
IB_MTU_LEN_2048;
- mcast_req.member_rec.pkey = IB_DEFAULT_PKEY;
+ mcast_req.member_rec.pkey =
p_port->p_adapter->guids.port_guid.pkey;
mcast_req.member_rec.sl_flow_hop =
ib_member_set_sl_flow_hop( 0, 0, 0 );
mcast_req.member_rec.scope_state =
@@ -5106,8 +5158,8 @@
mcast_req.pfn_mcast_cb = __bcast_cb;
mcast_req.timeout_ms =
p_port->p_adapter->params.sa_timeout;
mcast_req.retry_cnt =
p_port->p_adapter->params.sa_retry_cnt;
- mcast_req.port_guid =
p_port->p_adapter->guids.port_guid;
- mcast_req.pkey_index = 0;
+ mcast_req.port_guid =
p_port->p_adapter->guids.port_guid.guid;
+ mcast_req.pkey_index = p_port->pkey_index;
/* reference the object for the multicast join
request. */
ipoib_port_ref( p_port, ref_join_bcast );
@@ -5362,9 +5414,9 @@
}
/* Move the QP to RTS. */
- dgrm_info.port_guid =
p_port->p_adapter->guids.port_guid;
+ dgrm_info.port_guid =
p_port->p_adapter->guids.port_guid.guid;
dgrm_info.qkey = p_port->ib_mgr.bcast_rec.qkey;
- dgrm_info.pkey_index = 0;
+ dgrm_info.pkey_index = p_port->pkey_index;
status = p_port->p_adapter->p_ifc->init_dgrm_svc(
p_port->ib_mgr.h_qp, &dgrm_info );
if( status != IB_SUCCESS )
{
@@ -5464,9 +5516,9 @@
mcast_req.pfn_mcast_cb = __mcast_cb;
mcast_req.timeout_ms =
p_port->p_adapter->params.sa_timeout;
mcast_req.retry_cnt =
p_port->p_adapter->params.sa_retry_cnt;
- mcast_req.port_guid =
p_port->p_adapter->guids.port_guid;
- mcast_req.pkey_index = 0;
-
+ mcast_req.port_guid =
p_port->p_adapter->guids.port_guid.guid;
+ mcast_req.pkey_index = p_port->pkey_index;
+ mcast_req.member_rec.pkey =
p_port->p_adapter->guids.port_guid.pkey;
/*
* Create the endpoint and insert it in the port.
Since we don't wait for
* the mcast SA operations to complete before
returning from the multicast
Index: ulp/ipoib/kernel/ipoib_port.h
===================================================================
--- ulp/ipoib/kernel/ipoib_port.h (revision 1081)
+++ ulp/ipoib/kernel/ipoib_port.h (working copy)
@@ -506,6 +506,7 @@
atomic32_t
endpt_rdr;
atomic32_t
hdr_idx;
+ uint16_t
pkey_index;
ipoib_hdr_t
hdr[1]; /* Must be last! */
} ipoib_port_t;
Slava Strebkov
SW Engineer
Voltaire
099718750
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080504/dd773709/attachment.html>
More information about the ofw
mailing list