\r
TARGETLIBS= \\r
$(TARGETPATH)\*\complib.lib \\r
- $(DDK_LIB_PATH)\ndis.lib\r
+ $(DDK_LIB_PATH)\ndis.lib \\r
+ $(DDK_LIB_PATH)\ntstrsafe.lib \\r
+ $(DDK_LIB_PATH)\strsafe.lib\r
\r
!if !defined(DDK_TARGET_OS) || "$(DDK_TARGET_OS)"=="Win2K"\r
#\r
# The driver is built in the Win2K build environment\r
# - use the library version of safe strings \r
#\r
-TARGETLIBS= $(TARGETLIBS) $(DDK_LIB_PATH)\ntstrsafe.lib\r
+#TARGETLIBS= $(TARGETLIBS) $(DDK_LIB_PATH)\ntstrsafe.lib\r
!endif\r
\r
!IFDEF ENABLE_EVENT_TRACING\r
/*\r
* Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
* Copyright (c) 2006 Mellanox Technologies. All rights reserved.\r
+ * Portions Copyright (c) 2008 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
("Port %016I64x (CA %016I64x port %d) initializing\n",\r
- p_adapter->guids.port_guid, p_adapter->guids.ca_guid,\r
+ p_adapter->guids.port_guid.guid, p_adapter->guids.ca_guid,\r
p_adapter->guids.port_num) );\r
\r
cl_status = cl_obj_init( &p_adapter->obj, CL_DESTROY_SYNC,\r
&p_adapter->mutex, Executive, KernelMode, FALSE, NULL );\r
cl_obj_lock( &p_adapter->obj );\r
p_adapter->state = IB_PNP_PORT_REMOVE;\r
+\r
/*\r
* Clear the pointer to the port object since the object destruction\r
* will cascade to child objects. This prevents potential duplicate\r
* destruction (or worse, stale pointer usage).\r
*/\r
p_adapter->p_port = NULL;\r
+\r
cl_obj_unlock( &p_adapter->obj );\r
\r
KeReleaseMutex( &p_adapter->mutex, FALSE );\r
\r
/* Validate the port GUID and generate the MAC address. */\r
status =\r
- ipoib_mac_from_guid( p_adapter->guids.port_guid, &p_adapter->mac );\r
+ ipoib_mac_from_guid( p_adapter->guids.port_guid.guid, &p_adapter->mac );\r
if( status != IB_SUCCESS )\r
{\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
case IB_PNP_PORT_ADD:\r
CL_ASSERT( !p_pnp_rec->context );\r
/* Only process our port GUID. */\r
- if( p_pnp_rec->guid != p_adapter->guids.port_guid )\r
+ if( p_pnp_rec->guid != p_adapter->guids.port_guid.guid )\r
{\r
status = IB_NOT_DONE;\r
break;\r
if( status == IB_SUCCESS )\r
p_adapter->hung = FALSE;\r
}\r
-\r
+ if (status == IB_NOT_DONE) {\r
+ p_adapter->reset = TRUE;\r
+ }\r
+ else {\r
+ p_adapter->reset = FALSE;\r
+ }\r
IPOIB_EXIT( IPOIB_DBG_INIT );\r
return status;\r
}\r
\r
if( p_port )\r
ipoib_port_destroy( p_port );\r
-\r
+ ASSERT(p_adapter->reset == TRUE);\r
if( state != IB_PNP_PORT_REMOVE )\r
{\r
status = __ipoib_pnp_reg( p_adapter, IB_PNP_FLAG_REG_COMPLETE );\r
/*\r
* Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
* Copyright (c) 2006 Mellanox Technologies. All rights reserved.\r
+ * Portions Copyright (c) 2008 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
#define IPV4_ADDR_SIZE 4\r
\r
+#define PORT_NUM_INDEX_IN_GUID 3 /* 0 based index into big endian GUID to get port number */\r
+\r
/*\r
* Macros\r
*/\r
__conn_drep_cb(\r
IN ib_cm_drep_rec_t* p_drep_rec );\r
\r
-static void\r
-__conn_err_listen_cb(\r
-IN ib_listen_err_rec_t* p_listen_err_rec );\r
-\r
static ib_api_status_t\r
__conn_accept(\r
IN ipoib_port_t* const p_port,\r
\r
cm_listen.qp_type = IB_QPT_RELIABLE_CONN;\r
cm_listen.ca_guid = p_port->p_adapter->guids.ca_guid;\r
- cm_listen.port_guid = p_port->p_adapter->guids.port_guid;\r
+ cm_listen.port_guid = p_port->p_adapter->guids.port_guid.guid;\r
cm_listen.lid = IB_ALL_LIDS;\r
cm_listen.pkey = IB_ALL_PKEYS; // TODO: set pkey\r
\r
ib_status = \r
p_port->p_adapter->p_ifc->cm_listen( p_port->p_adapter->h_al,\r
&cm_listen,\r
- __conn_err_listen_cb,\r
(const void *)p_port,\r
&p_port->p_local_endpt->conn.h_cm_listen );\r
\r
return;\r
}\r
\r
-static void\r
-__conn_err_listen_cb(\r
-IN ib_listen_err_rec_t* p_listen_err_rec )\r
-{\r
-\r
- IPOIB_ENTER( IPOIB_DBG_ENDPT );\r
- UNREFERENCED_PARAMETER( p_listen_err_rec );\r
- IPOIB_EXIT( IPOIB_DBG_ENDPT );\r
-}\r
-\r
static void\r
__endpt_cm_send_cb(\r
IN const ib_cq_handle_t h_cq,\r
* $Id$\r
*/\r
\r
-\r
+#include "limits.h"\r
#include "ipoib_driver.h"\r
#include "ipoib_debug.h"\r
\r
#include <complib/cl_init.h>\r
#include <initguid.h>\r
#include <iba/ipoib_ifc.h>\r
+#include "ntstrsafe.h"\r
+#include "strsafe.h"\r
+\r
+\r
\r
\r
#if defined(NDIS50_MINIPORT)\r
#error NDIS Version not defined, try defining NDIS50_MINIPORT or NDIS51_MINIPORT\r
#endif\r
\r
+PDRIVER_OBJECT g_p_drv_obj;\r
+\r
static const NDIS_OID SUPPORTED_OIDS[] =\r
{\r
OID_GEN_SUPPORTED_LIST,\r
uint32_t g_ipoib_dbg_flags = 0x00000fff;\r
ipoib_globals_t g_ipoib = {0};\r
\r
+typedef struct _IPOIB_REG_ENTRY\r
+{\r
+ NDIS_STRING RegName; // variable name text\r
+ BOOLEAN bRequired; // 1 -> required, 0 -> optional\r
+ UINT FieldOffset; // offset in parent struct\r
+ UINT FieldSize; // size (in bytes) of the field\r
+ UINT Default; // default value to use\r
+ UINT Min; // minimum value allowed\r
+ UINT Max; // maximum value allowed\r
+} IPOIB_REG_ENTRY, *PIPOIB_REG_ENTRY;\r
+\r
+IPOIB_REG_ENTRY HCARegTable[] = {\r
+ // reg value name If Required Offset in parentr struct Field size Default Min Max\r
+ {NDIS_STRING_CONST("RqDepth"), 1, IPOIB_OFFSET(rq_depth), IPOIB_SIZE(rq_depth), 512, 128, 1024},\r
+ {NDIS_STRING_CONST("RqLowWatermark"), 0, IPOIB_OFFSET(rq_low_watermark), IPOIB_SIZE(rq_low_watermark), 4, 2, 8},\r
+ {NDIS_STRING_CONST("SqDepth"), 1, IPOIB_OFFSET(sq_depth), IPOIB_SIZE(sq_depth), 512, 128, 1024},\r
+ {NDIS_STRING_CONST("SendChksum"), 1, IPOIB_OFFSET(send_chksum_offload), IPOIB_SIZE(send_chksum_offload),0, 0, 1},\r
+ {NDIS_STRING_CONST("RecvChksum"), 1, IPOIB_OFFSET(recv_chksum_offload), IPOIB_SIZE(recv_chksum_offload),0, 0, 1},\r
+ {NDIS_STRING_CONST("SaTimeout"), 1, IPOIB_OFFSET(sa_timeout), IPOIB_SIZE(sa_timeout), 1000, 250, UINT_MAX},\r
+ {NDIS_STRING_CONST("SaRetries"), 1, IPOIB_OFFSET(sa_retry_cnt), IPOIB_SIZE(sa_retry_cnt), 10, 1, UINT_MAX},\r
+ {NDIS_STRING_CONST("RecvRatio"), 1, IPOIB_OFFSET(recv_pool_ratio), IPOIB_SIZE(recv_pool_ratio), 1, 1, 10},\r
+ {NDIS_STRING_CONST("PayloadMtu"), 1, IPOIB_OFFSET(payload_mtu), IPOIB_SIZE(payload_mtu), MAX_UD_PAYLOAD_MTU, 60, MAX_CM_PAYLOAD_MTU},\r
+ {NDIS_STRING_CONST("CmEnabled"), 1, IPOIB_OFFSET(cm_enabled), IPOIB_SIZE(cm_enabled), 0, 0, 1}\r
+}; \r
+\r
+#define IPOIB_NUM_REG_PARAMS (sizeof (HCARegTable) / sizeof(IPOIB_REG_ENTRY))\r
+\r
+\r
+static void\r
+ipoib_create_log(\r
+ NDIS_HANDLE h_adapter,\r
+ UINT ind,\r
+ ULONG eventLogMsgId)\r
+\r
+{\r
+#define cMaxStrLen 40\r
+#define cArrLen 3\r
+\r
+ PWCHAR logMsgArray[cArrLen]; \r
+ WCHAR strVal[cMaxStrLen];\r
+ NDIS_STRING AdapterInstanceName;\r
+\r
+ IPOIB_INIT_NDIS_STRING(&AdapterInstanceName);\r
+ if (NdisMQueryAdapterInstanceName(&AdapterInstanceName, h_adapter)!= NDIS_STATUS_SUCCESS ){\r
+ ASSERT(FALSE);\r
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR,IPOIB_DBG_ERROR, ("[IPoIB] Init:Failed to retreive adapter name.\n"));\r
+ return;\r
+ }\r
+ logMsgArray[0] = AdapterInstanceName.Buffer;\r
+ \r
+ if (RtlStringCbPrintfW(strVal, sizeof(strVal), L"0x%x", HCARegTable[ind].Default) != STATUS_SUCCESS) {\r
+ ASSERT(FALSE);\r
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR,IPOIB_DBG_ERROR,\r
+ ("[IPoIB] Init: Problem copying string value: exiting\n")); \r
+ return;\r
+ }\r
+ \r
+ logMsgArray[0] = AdapterInstanceName.Buffer;\r
+ logMsgArray[1] = HCARegTable[ind].RegName.Buffer;\r
+ logMsgArray[2] = strVal;\r
+ \r
+ NdisWriteEventLogEntry(g_p_drv_obj, eventLogMsgId, 0, cArrLen, &logMsgArray, 0, NULL);\r
+\r
+}\r
+\r
+\r
\r
NTSTATUS\r
DriverEntry(\r
NDIS_MINIPORT_CHARACTERISTICS characteristics;\r
\r
IPOIB_ENTER( IPOIB_DBG_INIT );\r
+ g_p_drv_obj = p_drv_obj;\r
\r
#ifdef _DEBUG_\r
PAGED_CODE();\r
}\r
\r
\r
+\r
NDIS_STATUS\r
ipoib_get_adapter_params(\r
IN NDIS_HANDLE* const wrapper_config_context,\r
NDIS_STATUS status;\r
NDIS_HANDLE h_config;\r
NDIS_CONFIGURATION_PARAMETER *p_param;\r
- NDIS_STRING keyword;\r
PUCHAR mac;\r
UINT len;\r
+ UINT value;\r
+ PIPOIB_REG_ENTRY pRegEntry;\r
+ UINT i;\r
+ PUCHAR structPointer;\r
+ int sq_depth_step = 128;\r
\r
IPOIB_ENTER( IPOIB_DBG_INIT );\r
\r
return status;\r
}\r
\r
- /* Required: CM mode flag */\r
- RtlInitUnicodeString( &keyword, L"CmEnabled" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS )\r
+ // read all the registry values \r
+ for (i = 0, pRegEntry = HCARegTable; i < IPOIB_NUM_REG_PARAMS; ++i)\r
{\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("CmEnabled parameter missing. Use the default.\n") );\r
- }\r
+ // initialize pointer to appropriate place inside 'params'\r
+ structPointer = (PUCHAR) &p_adapter->params + pRegEntry[i].FieldOffset;\r
+\r
+ // Get the configuration value for a specific parameter. Under NT the\r
+ // parameters are all read in as DWORDs.\r
+ NdisReadConfiguration(\r
+ &status,\r
+ &p_param,\r
+ h_config,\r
+ &pRegEntry[i].RegName,\r
+ NdisParameterInteger);\r
+\r
+ // If the parameter was present, then check its value for validity.\r
+ if (status == NDIS_STATUS_SUCCESS)\r
+ {\r
+ // Check that param value is not too small or too large\r
+ if (p_param->ParameterData.IntegerData < pRegEntry[i].Min ||\r
+ p_param->ParameterData.IntegerData > pRegEntry[i].Max)\r
+ {\r
+ value = pRegEntry[i].Default;\r
+ ipoib_create_log(p_adapter->h_adapter, i, EVENT_IPOIB_WRONG_PARAMETER_WRN);\r
+ IPOIB_PRINT(TRACE_LEVEL_VERBOSE, IPOIB_DBG_INIT, ("Read configuration.Registry %S value is out of range, setting default value= 0x%x\n", pRegEntry[i].RegName.Buffer, value)); \r
\r
- p_adapter->params.cm_enabled = ( status != NDIS_STATUS_SUCCESS) ? \r
- FALSE : p_param->ParameterData.IntegerData;\r
+ }\r
+ else\r
+ {\r
+ value = p_param->ParameterData.IntegerData;\r
+ IPOIB_PRINT(TRACE_LEVEL_VERBOSE, IPOIB_DBG_INIT, ("Read configuration. Registry %S, Value= 0x%x\n", pRegEntry[i].RegName.Buffer, value));\r
+ }\r
+ }\r
\r
- /* Required: Receive queue depth. */\r
- RtlInitUnicodeString( &keyword, L"RqDepth" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS )\r
- {\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("Receive Queue Depth parameter missing.\n") );\r
- return status;\r
- }\r
- p_adapter->params.rq_depth = p_param->ParameterData.IntegerData;\r
+ else\r
+ {\r
+ value = pRegEntry[i].Default;\r
+ status = NDIS_STATUS_SUCCESS;\r
+ if (pRegEntry[i].bRequired)\r
+ {\r
+ ipoib_create_log(p_adapter->h_adapter, i, EVENT_IPOIB_WRONG_PARAMETER_ERR);\r
+ IPOIB_PRINT(TRACE_LEVEL_ERROR, IPOIB_DBG_INIT, ("Read configuration.Registry %S value not found, setting default value= 0x%x\n", pRegEntry[i].RegName.Buffer, value));\r
+ }\r
+ else\r
+ {\r
+ ipoib_create_log(p_adapter->h_adapter, i, EVENT_IPOIB_WRONG_PARAMETER_INFO);\r
+ IPOIB_PRINT(TRACE_LEVEL_VERBOSE, IPOIB_DBG_INIT, ("Read configuration. Registry %S value not found, Value= 0x%x\n", pRegEntry[i].RegName.Buffer, value));\r
+ }\r
\r
- /* Optional: Receive queue low watermark. */\r
- RtlInitUnicodeString( &keyword, L"RqLowWatermark" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS || !p_param->ParameterData.IntegerData )\r
- {\r
- p_adapter->params.rq_low_watermark = p_adapter->params.rq_depth >> 2;\r
- }\r
- else\r
- {\r
- p_adapter->params.rq_low_watermark =\r
- p_adapter->params.rq_depth / p_param->ParameterData.IntegerData;\r
- }\r
+ }\r
+ //\r
+ // Store the value in the adapter structure.\r
+ //\r
+ switch(pRegEntry[i].FieldSize)\r
+ {\r
+ case 1:\r
+ *((PUCHAR) structPointer) = (UCHAR) value;\r
+ break;\r
\r
- /* Required: Send queue depth. */\r
- RtlInitUnicodeString( &keyword, L"SqDepth" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS )\r
- {\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("Send Queue Depth parameter missing.\n") );\r
- return status;\r
- }\r
- p_adapter->params.sq_depth = p_param->ParameterData.IntegerData;\r
- /* Send queue depth needs to be a power of two. */\r
- if( p_adapter->params.sq_depth <= 128 )\r
- p_adapter->params.sq_depth = 128;\r
- else if( p_adapter->params.sq_depth <= 256 )\r
- p_adapter->params.sq_depth = 256;\r
- else if( p_adapter->params.sq_depth <= 512 )\r
- p_adapter->params.sq_depth = 512;\r
- else\r
- p_adapter->params.sq_depth = 1024;\r
+ case 2:\r
+ *((PUSHORT) structPointer) = (USHORT) value;\r
+ break;\r
\r
- /* Required: Send Checksum Offload. */\r
- RtlInitUnicodeString( &keyword, L"SendChksum" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS )\r
- {\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("Send Checksum Offload parameter missing.\n") );\r
- return status;\r
- }\r
- p_adapter->params.send_chksum_offload = (p_param->ParameterData.IntegerData != 0);\r
+ case 4:\r
+ *((PULONG) structPointer) = (ULONG) value;\r
+ break;\r
\r
- /* Required: Send Checksum Offload. */\r
- RtlInitUnicodeString( &keyword, L"RecvChksum" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS )\r
- {\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("Recv Checksum Offload parameter missing.\n") );\r
- return status;\r
+ default:\r
+ IPOIB_PRINT(TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR, ("Bogus field size %d\n", pRegEntry[i].FieldSize));\r
+ break;\r
+ }\r
}\r
- p_adapter->params.recv_chksum_offload = (p_param->ParameterData.IntegerData != 0);\r
\r
- /* Required: SA query timeout, in milliseconds. */\r
- RtlInitUnicodeString( &keyword, L"SaTimeout" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS )\r
- {\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("SA query timeout parameter missing.\n") );\r
- return status;\r
- }\r
- p_adapter->params.sa_timeout = p_param->ParameterData.IntegerData;\r
+ // Send queue depth needs to be a power of two\r
+ //static const INT sq_depth_step = 128;\r
\r
- /* Required: SA query retry count. */\r
- RtlInitUnicodeString( &keyword, L"SaRetries" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS )\r
- {\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("SA query retry count parameter missing.\n") );\r
- return status;\r
- }\r
- p_adapter->params.sa_retry_cnt = p_param->ParameterData.IntegerData;\r
+ if (p_adapter->params.sq_depth % sq_depth_step) {\r
+ static const c_sq_ind = 2;\r
+ p_adapter->params.sq_depth = sq_depth_step *(\r
+ p_adapter->params.sq_depth / sq_depth_step + !!( (p_adapter->params.sq_depth % sq_depth_step) > (sq_depth_step/2) ));\r
+ ipoib_create_log(p_adapter->h_adapter, c_sq_ind, EVENT_IPOIB_WRONG_PARAMETER_WRN);\r
+ IPOIB_PRINT(TRACE_LEVEL_VERBOSE, IPOIB_DBG_INIT, ("SQ DEPTH value was rounded to the closest acceptable value of 0x%x\n", p_adapter->params.sq_depth ));\r
\r
- /* Required: Receive pool to queue depth ratio. */\r
- RtlInitUnicodeString( &keyword, L"RecvRatio" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS )\r
- {\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("Receive pool to queue depth ratio parameter missing.\n") );\r
- return status;\r
}\r
- p_adapter->params.recv_pool_ratio = p_param->ParameterData.IntegerData;\r
\r
- /* required: MTU size. */\r
- RtlInitUnicodeString( &keyword, L"PayloadMtu" );\r
- NdisReadConfiguration(\r
- &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
- if( status != NDIS_STATUS_SUCCESS )\r
- {\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("PayloadMtu parameter missing. Use the default.\n") );\r
- return status;\r
- }\r
- /*payload mtu for UD QP */\r
- p_adapter->params.payload_mtu = \r
- min( MAX_UD_PAYLOAD_MTU, p_param->ParameterData.IntegerData );\r
+\r
+ // Adjusting the low watermark parameter\r
+ p_adapter->params.rq_low_watermark =\r
+ p_adapter->params.rq_depth / p_adapter->params.rq_low_watermark;\r
+\r
p_adapter->params.cm_payload_mtu =\r
- min( MAX_CM_PAYLOAD_MTU, p_param->ParameterData.IntegerData );\r
- p_adapter->params.xfer_block_size = \r
- ( sizeof(eth_hdr_t) + p_adapter->params.payload_mtu );\r
+ min( MAX_CM_PAYLOAD_MTU, p_adapter->params.payload_mtu );\r
p_adapter->params.cm_xfer_block_size = \r
p_adapter->params.cm_payload_mtu + sizeof(eth_hdr_t);\r
+ p_adapter->params.payload_mtu = \r
+ min( MAX_UD_PAYLOAD_MTU, p_adapter->params.payload_mtu);\r
+ p_adapter->params.xfer_block_size = (sizeof(eth_hdr_t) + p_adapter->params.payload_mtu);\r
\r
NdisReadNetworkAddress( &status, &mac, &len, h_config );\r
\r
\r
IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
("Port %016I64x (CA %016I64x port %d) halting\n",\r
- p_adapter->guids.port_guid, p_adapter->guids.ca_guid,\r
+ p_adapter->guids.port_guid.guid, p_adapter->guids.ca_guid,\r
p_adapter->guids.port_num) );\r
\r
ipoib_destroy_adapter( p_adapter );\r
\r
IPOIB_ENTER( IPOIB_DBG_OID );\r
\r
+ if(p_adapter->guids.port_guid.pkey != IB_DEFAULT_PKEY)\r
+ {\r
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR,IPOIB_DBG_ERROR,\r
+ ("ATS Service available for default pkey only\n")); \r
+ return;\r
+ }\r
port_num = p_adapter->guids.port_num;\r
\r
/* Setup our service call with things common to all calls */\r
cl_memset( &ib_service, 0, sizeof(ib_service) );\r
\r
/* BUGBUG Only register local subnet GID prefix for now */\r
- ib_gid_set_default( &port_gid, p_adapter->guids.port_guid );\r
+ ib_gid_set_default( &port_gid, p_adapter->guids.port_guid.guid );\r
ib_service.svc_rec.service_gid = port_gid;\r
\r
ib_service.svc_rec.service_pkey = IB_DEFAULT_PKEY;\r
\r
/* Must cast here because the service name is an array of unsigned chars but\r
* strcpy want a pointer to a signed char */\r
- strcpy( (char *)ib_service.svc_rec.service_name, ATS_NAME );\r
-\r
+ if ( StringCchCopy( (char *)ib_service.svc_rec.service_name, \r
+ sizeof(ib_service.svc_rec.service_name) / sizeof(char), ATS_NAME ) != S_OK) {\r
+ ASSERT(FALSE);\r
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR,IPOIB_DBG_ERROR,\r
+ ("Problem copying ATS name: exiting\n"));\r
+ return;\r
+ }\r
+ \r
/* IP Address in question will be put in below */\r
- ib_service.port_guid = p_adapter->guids.port_guid;\r
+ ib_service.port_guid = p_adapter->guids.port_guid.guid;\r
ib_service.timeout_ms = p_adapter->params.sa_timeout;\r
ib_service.retry_cnt = p_adapter->params.sa_retry_cnt;\r
\r
/*\r
* Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
* Copyright (c) 2006 Mellanox Technologies. All rights reserved.\r
+ * Portions Copyright (c) 2008 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
cl_status_t status;\r
\r
IPOIB_ENTER( IPOIB_DBG_ENDPT );\r
- \r
+\r
p_endpt = cl_zalloc( sizeof(ipoib_endpt_t) );\r
if( !p_endpt )\r
{\r
p_port->p_adapter->h_al, p_endpt->h_query );\r
p_endpt->h_query = NULL;\r
}\r
+\r
/* Leave the multicast group if it exists. */\r
if( p_endpt->h_mcast )\r
{\r
\r
cl_memclr( &path, sizeof(ib_path_rec_t) );\r
path.dgid = p_endpt->dgid;\r
- ib_gid_set_default( &path.sgid, p_port->p_adapter->guids.port_guid );\r
+ ib_gid_set_default( &path.sgid, p_port->p_adapter->guids.port_guid.guid );\r
path.num_path = 0x1;\r
\r
cl_memclr( &query, sizeof(ib_query_req_t) );\r
query.query_type = IB_QUERY_USER_DEFINED;\r
query.p_query_input = &info;\r
- query.port_guid = p_port->p_adapter->guids.port_guid;\r
+ query.port_guid = p_port->p_adapter->guids.port_guid.guid;\r
query.timeout_ms = p_port->p_adapter->params.sa_timeout;\r
query.retry_cnt = p_port->p_adapter->params.sa_retry_cnt;\r
\r
return NDIS_STATUS_PENDING;\r
}\r
\r
+\r
static void\r
__path_query_cb(\r
IN ib_query_rec_t *p_query_rec )\r
{\r
- ib_api_status_t ib_status;\r
+ ib_api_status_t status;\r
ipoib_endpt_t *p_endpt;\r
ipoib_port_t *p_port;\r
ib_av_attr_t av_attr;\r
}\r
\r
p_path = ib_get_query_path_rec( p_query_rec->p_result_mad, 0 );\r
- \r
+\r
cl_memclr( &av_attr, sizeof(ib_av_attr_t) );\r
\r
av_attr.port_num = p_port->port_num;\r
p_port->p_adapter->p_ifc->put_mad( p_query_rec->p_result_mad );\r
\r
/* Create the AV. */\r
- ib_status = p_port->p_adapter->p_ifc->create_av(\r
+ status = p_port->p_adapter->p_ifc->create_av(\r
p_port->ib_mgr.h_pd, &av_attr, &p_endpt->h_av );\r
- if( ib_status != IB_SUCCESS )\r
+ if( status != IB_SUCCESS )\r
{\r
p_port->p_adapter->hung = TRUE;\r
ipoib_endpt_deref( p_endpt );\r
cl_obj_unlock( &p_endpt->obj );\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
("ib_create_av failed with %s\n", \r
- p_port->p_adapter->p_ifc->get_err_str( ib_status )) );\r
+ p_port->p_adapter->p_ifc->get_err_str( status )) );\r
return;\r
}\r
\r
p_ipoib->type.ip.prot.udp.hdr.src_port == DHCP_PORT_CLIENT) ||\r
(p_ipoib->type.ip.prot.udp.hdr.dst_port == DHCP_PORT_CLIENT &&\r
p_ipoib->type.ip.prot.udp.hdr.src_port == DHCP_PORT_SERVER) );\r
-}
\ No newline at end of file
+}\r
/*\r
* Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
* Copyright (c) 2006 Mellanox Technologies. All rights reserved.\r
+ * Portions Copyright (c) 2008 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
* If the h_mcast member is set, the endpoint is never expired.\r
*********/\r
\r
+\r
ipoib_endpt_t*\r
ipoib_endpt_create(\r
IN const ib_gid_t* const p_dgid,\r
\r
ib_api_status_t\r
ipoib_endpt_set_mcast(\r
- IN ipoib_endpt_t* const p_endpt,\r
- IN ib_pd_handle_t h_pd,\r
- IN uint8_t port_num,\r
- IN ib_mcast_rec_t* const p_mcast_rec );\r
+ IN ipoib_endpt_t* const p_endpt,\r
+ IN ib_pd_handle_t h_pd,\r
+ IN uint8_t port_num,\r
+ IN ib_mcast_rec_t* const p_mcast_rec );\r
\r
\r
static inline void\r
ipoib_endpt_ref(\r
- IN ipoib_endpt_t* const p_endpt )\r
+ IN ipoib_endpt_t* const p_endpt )\r
{\r
CL_ASSERT( p_endpt );\r
\r
\r
static inline void\r
ipoib_endpt_deref(\r
- IN ipoib_endpt_t* const p_endpt )\r
+ IN ipoib_endpt_t* const p_endpt )\r
{\r
cl_obj_deref( &p_endpt->obj );\r
}\r
\r
NDIS_STATUS\r
ipoib_endpt_queue(\r
- IN ipoib_endpt_t* const p_endpt );\r
+ IN ipoib_endpt_t* const p_endpt );\r
\r
struct _ipoib_port *\r
ipoib_endpt_parent(\r
/*\r
* Copyright (c) 2005 Mellanox Technologies. All rights reserved.\r
* Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Portions Copyright (c) 2008 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
{\r
pAdapter = CONTAINING_RECORD( pItem, ipoib_adapter_t, entry );\r
pOut->Ports[pOut->NumPorts].CaGuid = pAdapter->guids.ca_guid;\r
- pOut->Ports[pOut->NumPorts].PortGuid = pAdapter->guids.port_guid;\r
+ pOut->Ports[pOut->NumPorts].PortGuid = pAdapter->guids.port_guid.guid;\r
+ pOut->Ports[pOut->NumPorts].PKey = IB_DEFAULT_PKEY;\r
pOut->Ports[pOut->NumPorts].PortNum = pAdapter->guids.port_num;\r
pOut->NumPorts++;\r
\r
pItem = cl_qlist_next( pItem ) )\r
{\r
pAdapter = CONTAINING_RECORD( pItem, ipoib_adapter_t, entry );\r
- if( PortGuid && pAdapter->guids.port_guid != PortGuid )\r
+ if( PortGuid && pAdapter->guids.port_guid.guid != PortGuid )\r
continue;\r
\r
cl_obj_lock( &pAdapter->obj );\r
pItem = cl_qlist_next( pItem ) )\r
{\r
pAdapter = CONTAINING_RECORD( pItem, ipoib_adapter_t, entry );\r
- if( pIn->PortGuid != pAdapter->guids.port_guid )\r
+ if( pIn->PortGuid != pAdapter->guids.port_guid.guid )\r
continue;\r
\r
/* Found the port - lookup the MAC. */\r
if (!memcmp( &pIn->Address.Address[12], pAddr->address.as_bytes, IPV4_ADDR_SIZE))\r
{\r
pOut->Port.CaGuid = pAdapter->guids.ca_guid;\r
- pOut->Port.PortGuid = pAdapter->guids.port_guid;\r
+ pOut->Port.PortGuid = pAdapter->guids.port_guid.guid;\r
+ pOut->Port.PKey = IB_DEFAULT_PKEY;\r
pOut->Port.PortNum = pAdapter->guids.port_num;\r
pIrp->IoStatus.Information = sizeof(IOCTL_IBAT_IP_TO_PORT_OUT);\r
status = STATUS_SUCCESS;\r
Language=English\r
%2: The local port rate is too slow for the existing broadcast MC group.\r
.\r
+\r
+MessageId=0x0058\r
+Facility=IPoIB\r
+Severity=Error\r
+SymbolicName=EVENT_IPOIB_WRONG_PARAMETER_ERR\r
+Language=English\r
+%2: Incorrect value or non-existing registry for the required IPoIB parameter %3, overriding it by default value: %4\r
+.\r
+\r
+MessageId=0x0059\r
+Facility=IPoIB\r
+Severity=Warning\r
+SymbolicName=EVENT_IPOIB_WRONG_PARAMETER_WRN\r
+Language=English\r
+%2: Incorrect value or non-existing registry entry for the required IPoIB parameter %3, overriding it by default value: %4\r
+.\r
+\r
+MessageId=0x005A\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_WRONG_PARAMETER_INFO\r
+Language=English\r
+%2: Incorrect value or non-existing registry for the optional IPoIB parameter %3, overriding it by default value: %4\r
+.\r
/*\r
* Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
* Copyright (c) 2006 Mellanox Technologies. All rights reserved.\r
+ * Portions Copyright (c) 2008 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
IN ipoib_port_t* const p_port,\r
IN ib_ca_attr_t** pp_ca_attrs );\r
\r
+static uint16_t\r
+__port_get_pkey_index(\r
+ IN ib_ca_attr_t* const p_ca_attrs,\r
+ IN ib_net16_t pkey );\r
static void\r
__srq_async_event_cb(\r
IN ib_async_event_rec_t *p_event_rec );\r
("Query CA attributes failed\n" ) );\r
return status;\r
}\r
+ p_port->pkey_index = __port_get_pkey_index( p_port->p_ca_attrs,\r
+ p_port->p_adapter->guids.port_guid.pkey );\r
\r
/* Allocate the PD. */\r
status = p_port->p_adapter->p_ifc->alloc_pd(\r
qp_create.sq_sge = MAX_SEND_SGE;\r
qp_create.h_sq_cq = p_port->ib_mgr.h_send_cq;\r
qp_create.sq_signaled = TRUE;\r
- \r
status = p_port->p_adapter->p_ifc->create_qp(\r
p_port->ib_mgr.h_pd, &qp_create, p_port,\r
__qp_event, &p_port->ib_mgr.h_qp );\r
return ib_status;\r
}\r
\r
+static uint16_t\r
+__port_get_pkey_index(\r
+ IN ib_ca_attr_t* const p_ca_attrs,\r
+ IN ib_net16_t pkey )\r
+{\r
+ uint16_t index;\r
+ CL_ASSERT( p_ca_attrs->p_port_attr->p_pkey_table[0] == IB_DEFAULT_PKEY );\r
+ for( index = 0; index < p_ca_attrs->p_port_attr->num_pkeys; index++ )\r
+ {\r
+ if( p_ca_attrs->p_port_attr->p_pkey_table[index] == pkey )\r
+ return index;\r
+ }\r
+ return 0;\r
+}\r
+\r
void\r
ipoib_port_srq_destroy( \r
IN ipoib_port_t* const p_port )\r
CL_ASSERT( status == IB_SUCCESS );\r
p_port->ib_mgr.h_ca = NULL;\r
}\r
- \r
+\r
IPOIB_EXIT( IPOIB_DBG_INIT );\r
}\r
\r
{\r
cl_perf_start( PostRecv );\r
status = p_port->p_adapter->p_ifc->post_recv(\r
- p_port->ib_mgr.h_qp, &p_head->wr, &p_failed );\r
+ p_port->ib_mgr.h_qp, &p_head->wr, &p_failed );\r
cl_perf_stop( &p_port->p_adapter->perf, PostRecv );\r
\r
if( status != IB_SUCCESS )\r
p_desc->local_ds[1].length = tot_len - sizeof(eth_hdr_t);\r
p_desc->local_ds[1].lkey = p_port->ib_mgr.lkey;\r
p_desc->wr.num_ds = 2;\r
+\r
/* Copy the packet. */\r
NdisCopyFromPacketToPacketSafe( p_packet, bytes_copied, tot_len,\r
p_desc->p_pkt, bytes_copied, &bytes_copied,\r
return NDIS_STATUS_SUCCESS;\r
}\r
\r
+\r
+#if !IPOIB_USE_DMA\r
+/* Send using the MDL's page information rather than the SGL. */\r
+static ib_api_status_t\r
+__send_gen(\r
+ IN ipoib_port_t* const p_port,\r
+ IN ipoib_send_desc_t* const p_desc )\r
+{\r
+ uint32_t i, j = 1;\r
+ ULONG offset;\r
+ MDL *p_mdl;\r
+ UINT num_pages, tot_len;\r
+ ULONG buf_len;\r
+ PPFN_NUMBER page_array;\r
+ boolean_t hdr_done = FALSE;\r
+ ib_api_status_t status;\r
+\r
+ IPOIB_ENTER( IPOIB_DBG_SEND );\r
+\r
+ NdisQueryPacket( p_desc->p_pkt, &num_pages, NULL, &p_mdl,\r
+ &tot_len );\r
+\r
+ if( !p_mdl )\r
+ {\r
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+ ("No buffers associated with packet.\n") );\r
+ return IB_ERROR;\r
+ }\r
+\r
+ /* Remember that one of the DS entries is reserved for the IPoIB header. */\r
+ if( num_pages >= MAX_SEND_SGE )\r
+ {\r
+ IPOIB_PRINT(TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,\r
+ ("Too many buffers to fit in WR ds_array. Copying data.\n") );\r
+ status = __send_copy( p_port, p_desc );\r
+ IPOIB_EXIT( IPOIB_DBG_SEND );\r
+ return status;\r
+ }\r
+\r
+ CL_ASSERT( tot_len > sizeof(eth_hdr_t) );\r
+ CL_ASSERT( tot_len <= p_port->p_adapter->params.xfer_block_size );\r
+ /*\r
+ * Assume that the ethernet header is always fully contained\r
+ * in the first page of the first MDL. This makes for much\r
+ * simpler code.\r
+ */\r
+ offset = MmGetMdlByteOffset( p_mdl ) + sizeof(eth_hdr_t);\r
+ CL_ASSERT( offset <= PAGE_SIZE );\r
+\r
+ while( tot_len )\r
+ {\r
+ buf_len = MmGetMdlByteCount( p_mdl );\r
+ page_array = MmGetMdlPfnArray( p_mdl );\r
+ CL_ASSERT( page_array );\r
+ i = 0;\r
+ if( !hdr_done )\r
+ {\r
+ CL_ASSERT( buf_len >= sizeof(eth_hdr_t) );\r
+ /* Skip the ethernet header. */\r
+ buf_len -= sizeof(eth_hdr_t);\r
+ CL_ASSERT( buf_len <= p_port->p_adapter->params.payload_mtu );\r
+ if( buf_len )\r
+ {\r
+ /* The ethernet header is a subset of this MDL. */\r
+ CL_ASSERT( i == 0 );\r
+ if( offset < PAGE_SIZE )\r
+ {\r
+ p_desc->local_ds[j].lkey = p_port->ib_mgr.lkey;\r
+ p_desc->local_ds[j].vaddr = (page_array[i] << PAGE_SHIFT);\r
+ /* Add the byte offset since we're on the 1st page. */\r
+ p_desc->local_ds[j].vaddr += offset;\r
+ if( offset + buf_len > PAGE_SIZE )\r
+ {\r
+ p_desc->local_ds[j].length = PAGE_SIZE - offset;\r
+ buf_len -= p_desc->local_ds[j].length;\r
+ }\r
+ else\r
+ {\r
+ p_desc->local_ds[j].length = buf_len;\r
+ buf_len = 0;\r
+ }\r
+ /* This data segment is done. Move to the next. */\r
+ j++;\r
+ }\r
+ /* This page is done. Move to the next. */\r
+ i++;\r
+ }\r
+ /* Done handling the ethernet header. */\r
+ hdr_done = TRUE;\r
+ }\r
+\r
+ /* Finish this MDL */\r
+ while( buf_len )\r
+ {\r
+ p_desc->local_ds[j].lkey = p_port->ib_mgr.lkey;\r
+ p_desc->local_ds[j].vaddr = (page_array[i] << PAGE_SHIFT);\r
+ /* Add the first page's offset if we're on the first page. */\r
+ if( i == 0 )\r
+ p_desc->local_ds[j].vaddr += MmGetMdlByteOffset( p_mdl );\r
+\r
+ if( i == 0 && (MmGetMdlByteOffset( p_mdl ) + buf_len) > PAGE_SIZE )\r
+ {\r
+ /* Buffers spans pages. */\r
+ p_desc->local_ds[j].length =\r
+ PAGE_SIZE - MmGetMdlByteOffset( p_mdl );\r
+ buf_len -= p_desc->local_ds[j].length;\r
+ /* This page is done. Move to the next. */\r
+ i++;\r
+ }\r
+ else\r
+ {\r
+ /* Last page of the buffer. */\r
+ p_desc->local_ds[j].length = buf_len;\r
+ buf_len = 0;\r
+ }\r
+ /* This data segment is done. Move to the next. */\r
+ j++;\r
+ }\r
+\r
+ tot_len -= MmGetMdlByteCount( p_mdl );\r
+ if( !tot_len )\r
+ break;\r
+\r
+ NdisGetNextBuffer( p_mdl, &p_mdl );\r
+ if( !p_mdl )\r
+ {\r
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+ ("Failed to get next buffer.\n") );\r
+ return IB_ERROR;\r
+ }\r
+ }\r
+\r
+ /* Set the number of data segments. */\r
+ p_desc->wr.num_ds = j;\r
+\r
+ IPOIB_EXIT( IPOIB_DBG_SEND );\r
+ return IB_SUCCESS;\r
+}\r
+\r
+#else\r
+\r
static NDIS_STATUS\r
__send_gen(\r
IN ipoib_port_t* const p_port,\r
IPOIB_EXIT( IPOIB_DBG_SEND );\r
return NDIS_STATUS_SUCCESS;\r
}\r
+#endif\r
+\r
\r
static NDIS_STATUS\r
__send_mgr_filter_ip(\r
\r
CL_ASSERT( p_cid[1] == 21 );\r
p_cid[23]= DHCP_OPT_END;\r
- ib_gid_set_default( &gid, p_port->p_adapter->guids.port_guid );\r
+ ib_gid_set_default( &gid, p_port->p_adapter->guids.port_guid.guid );\r
cl_memcpy( &p_cid[7], &gid, sizeof(ib_gid_t) );\r
cl_memcpy( &p_cid[3], &p_port->ib_mgr.qpn, sizeof(p_port->ib_mgr.qpn) ); \r
p_ib_dhcp->htype = DHCP_HW_TYPE_IB;\r
p_desc->local_ds[1].length = sizeof(ip_hdr_t) + sizeof(udp_hdr_t) + sizeof(dhcp_pkt_t);\r
p_desc->local_ds[1].lkey = p_port->ib_mgr.lkey;\r
p_desc->wr.num_ds = 2;\r
-\r
IPOIB_EXIT( IPOIB_DBG_SEND );\r
return NDIS_STATUS_SUCCESS;\r
}\r
}\r
\r
ib_gid_set_default( &p_ib_arp->src_hw.gid,\r
- p_port->p_adapter->guids.port_guid );\r
+ p_port->p_adapter->guids.port_guid.guid );\r
p_ib_arp->src_ip = p_arp->src_ip;\r
if( cl_memcmp( &p_arp->dst_hw, &null_hw, sizeof(mac_addr_t) ) )\r
{\r
}\r
}\r
}\r
-\r
else\r
{\r
cl_memclr( &p_ib_arp->dst_hw, sizeof(ipoib_hw_addr_t) );\r
cl_perf_stop( &p_port->p_adapter->perf, ProcessFailedSends );\r
continue;\r
}\r
+\r
/* Post the WR. */\r
cl_perf_start( PostSend );\r
ib_status = p_port->p_adapter->p_ifc->post_send( desc.send_qp, &desc.wr, NULL );\r
IPOIB_EXIT( IPOIB_DBG_SEND );\r
}\r
\r
+\r
void\r
ipoib_port_resume(\r
IN ipoib_port_t* const p_port )\r
IN ipoib_port_t* const p_port )\r
{\r
IPOIB_ENTER( IPOIB_DBG_INIT );\r
-\r
CL_ASSERT( cl_is_qmap_empty( &p_port->endpt_mgr.mac_endpts ) );\r
CL_ASSERT( cl_is_qmap_empty( &p_port->endpt_mgr.lid_endpts ) );\r
CL_ASSERT( cl_is_fmap_empty( &p_port->endpt_mgr.gid_endpts ) );\r
* from the __port_destroying function, and destruction cascades\r
* to all child objects. Just clear all the maps.\r
*/\r
-\r
cl_qmap_remove_all( &p_port->endpt_mgr.mac_endpts );\r
cl_qmap_remove_all( &p_port->endpt_mgr.lid_endpts );\r
cl_fmap_remove_all( &p_port->endpt_mgr.gid_endpts );\r
- \r
cl_obj_unlock( &p_port->obj );\r
\r
IPOIB_EXIT( IPOIB_DBG_ENDPT );\r
cl_qlist_t conn_list;\r
uint32_t local_exist = 0;\r
\r
+\r
IPOIB_ENTER( IPOIB_DBG_ENDPT );\r
\r
cl_qlist_init( &mc_list );\r
&p_endpt->lid_item );\r
p_endpt->dlid = 0;\r
}\r
+ \r
}\r
\r
cl_obj_unlock( &p_port->obj );\r
/* Wait for all readers to complete. */\r
while( p_port->endpt_rdr > 1 )\r
;\r
- \r
+\r
/* Remove the endpoint from the maps so further requests don't find it. */\r
cl_qmap_remove_item( &p_port->endpt_mgr.mac_endpts, &p_endpt->mac_item );\r
/*\r
cl_memclr( &query, sizeof(ib_query_req_t) );\r
query.query_type = IB_QUERY_USER_DEFINED;\r
query.p_query_input = &info;\r
- query.port_guid = p_port->p_adapter->guids.port_guid;\r
+ query.port_guid = p_port->p_adapter->guids.port_guid.guid;\r
query.timeout_ms = p_port->p_adapter->params.sa_timeout;\r
query.retry_cnt = p_port->p_adapter->params.sa_retry_cnt;\r
query.query_context = p_port;\r
\r
IPOIB_ENTER( IPOIB_DBG_INIT );\r
\r
- ib_gid_set_default( &gid, p_port->p_adapter->guids.port_guid );\r
+ ib_gid_set_default( &gid, p_port->p_adapter->guids.port_guid.guid );\r
p_endpt = ipoib_endpt_create(\r
&gid, p_port_info->base_lid, p_port->ib_mgr.qpn );\r
if( !p_endpt )\r
cl_memclr( &member_rec, sizeof(ib_member_rec_t) );\r
member_rec.mgid = bcast_mgid_template;\r
\r
+ member_rec.mgid.raw[4] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8) ;\r
+ member_rec.mgid.raw[5] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey;\r
+ member_rec.pkey = p_port->p_adapter->guids.port_guid.pkey;\r
cl_memclr( &query, sizeof(ib_query_req_t) );\r
query.query_type = IB_QUERY_USER_DEFINED;\r
query.p_query_input = &info;\r
- query.port_guid = p_port->p_adapter->guids.port_guid;\r
+ query.port_guid = p_port->p_adapter->guids.port_guid.guid;\r
query.timeout_ms = p_port->p_adapter->params.sa_timeout;\r
query.retry_cnt = p_port->p_adapter->params.sa_retry_cnt;\r
query.query_context = p_port;\r
/* We specify our port GID for the join operation. */\r
mcast_req.member_rec.port_gid.unicast.prefix = IB_DEFAULT_SUBNET_PREFIX;\r
mcast_req.member_rec.port_gid.unicast.interface_id =\r
- p_port->p_adapter->guids.port_guid;\r
+ p_port->p_adapter->guids.port_guid.guid;\r
\r
mcast_req.mcast_context = p_port;\r
mcast_req.pfn_mcast_cb = __bcast_cb;\r
mcast_req.timeout_ms = p_port->p_adapter->params.sa_timeout;\r
mcast_req.retry_cnt = p_port->p_adapter->params.sa_retry_cnt;\r
- mcast_req.port_guid = p_port->p_adapter->guids.port_guid;\r
- mcast_req.pkey_index = 0;\r
+ mcast_req.port_guid = p_port->p_adapter->guids.port_guid.guid;\r
+ mcast_req.pkey_index = p_port->pkey_index;\r
\r
if( ib_member_get_state( mcast_req.member_rec.scope_state ) !=\r
IB_MC_REC_STATE_FULL_MEMBER )\r
* We specify the MGID since we don't want the SA to generate it for us.\r
*/\r
mcast_req.member_rec.mgid = bcast_mgid_template;\r
+ mcast_req.member_rec.mgid.raw[4] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8); \r
+ mcast_req.member_rec.mgid.raw[5] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey;\r
ib_gid_set_default( &mcast_req.member_rec.port_gid,\r
- p_port->p_adapter->guids.port_guid );\r
+ p_port->p_adapter->guids.port_guid.guid );\r
/*\r
* IPOIB spec requires that the QKEY have the MSb set so that the QKEY\r
* from the QP is used rather than the QKEY in the send WR.\r
mcast_req.member_rec.mtu =\r
(IB_PATH_SELECTOR_EXACTLY << 6) | IB_MTU_LEN_2048;\r
\r
- mcast_req.member_rec.pkey = IB_DEFAULT_PKEY;\r
+ mcast_req.member_rec.pkey = p_port->p_adapter->guids.port_guid.pkey;\r
\r
mcast_req.member_rec.sl_flow_hop = ib_member_set_sl_flow_hop( 0, 0, 0 );\r
mcast_req.member_rec.scope_state =\r
mcast_req.pfn_mcast_cb = __bcast_cb;\r
mcast_req.timeout_ms = p_port->p_adapter->params.sa_timeout;\r
mcast_req.retry_cnt = p_port->p_adapter->params.sa_retry_cnt;\r
- mcast_req.port_guid = p_port->p_adapter->guids.port_guid;\r
- mcast_req.pkey_index = 0;\r
+ mcast_req.port_guid = p_port->p_adapter->guids.port_guid.guid;\r
+ mcast_req.pkey_index = p_port->pkey_index;\r
\r
/* reference the object for the multicast join request. */\r
ipoib_port_ref( p_port, ref_join_bcast );\r
__recv_mgr_repost( p_port );\r
cl_spinlock_release( &p_port->recv_lock );\r
\r
- /* Notify the adapter that we now have an active conn. */\r
+ /* Notify the adapter that we now have an active connection. */\r
ipoib_set_active( p_port->p_adapter );\r
\r
if( p_port->p_adapter->params.cm_enabled &&\r
}\r
\r
/* Move the QP to RTS. */\r
- dgrm_info.port_guid = p_port->p_adapter->guids.port_guid;\r
+ dgrm_info.port_guid = p_port->p_adapter->guids.port_guid.guid;\r
dgrm_info.qkey = p_port->ib_mgr.bcast_rec.qkey;\r
- dgrm_info.pkey_index = 0;\r
+ dgrm_info.pkey_index = p_port->pkey_index;\r
status = p_port->p_adapter->p_ifc->init_dgrm_svc( p_port->ib_mgr.h_qp, &dgrm_info );\r
if( status != IB_SUCCESS )\r
{\r
mcast_req.pfn_mcast_cb = __mcast_cb;\r
mcast_req.timeout_ms = p_port->p_adapter->params.sa_timeout;\r
mcast_req.retry_cnt = p_port->p_adapter->params.sa_retry_cnt;\r
- mcast_req.port_guid = p_port->p_adapter->guids.port_guid;\r
- mcast_req.pkey_index = 0;\r
-\r
+ mcast_req.port_guid = p_port->p_adapter->guids.port_guid.guid;\r
+ mcast_req.pkey_index = p_port->pkey_index;\r
+ mcast_req.member_rec.pkey = p_port->p_adapter->guids.port_guid.pkey;\r
/*\r
* Create the endpoint and insert it in the port. Since we don't wait for\r
* the mcast SA operations to complete before returning from the multicast\r
IPOIB_EXIT( IPOIB_DBG_MCAST );\r
}\r
\r
+\r
+\r
void\r
__leave_error_mcast_cb(\r
IN void *context )\r
{\r
return __recv_dhcp(\r
p_port, p_ipoib, p_eth, p_src,p_dst );\r
-}
\ No newline at end of file
+}\r
/*\r
* Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
* Copyright (c) 2006 Mellanox Technologies. All rights reserved.\r
+ * Portions Copyright (c) 2008 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
} ipoib_pkt_type_t;\r
\r
+\r
typedef struct _ipoib_recv_desc\r
{\r
cl_pool_item_t item; /* Must be first. */\r
*/\r
#define MAX_BUNDLE_ID_LENGTH 32\r
\r
-/* MLX4 supports 4K MTU */\r
-#define IB_MTU 4096\r
+\r
+#define IB_MTU 2048\r
/*\r
* Header length as defined by IPoIB spec:\r
* http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-04.txt\r
*/\r
\r
-#define MAX_PAYLOAD_MTU (IB_MTU - sizeof(ipoib_hdr_t))\r
-\r
+#define MAX_UD_PAYLOAD_MTU (IB_MTU - sizeof(ipoib_hdr_t))\r
+#define MAX_CM_PAYLOAD_MTU (65520)\r
/*\r
* Only the protocol type is sent as part of the UD payload\r
* since the rest of the Ethernet header is encapsulated in the\r
* various IB headers. We report out buffer space as if we\r
* transmit the ethernet headers.\r
*/\r
-#define MAX_XFER_BLOCK_SIZE (sizeof(eth_hdr_t) + MAX_PAYLOAD_MTU)\r
+#define MAX_XFER_BLOCK_SIZE (sizeof(eth_hdr_t) + MAX_UD_PAYLOAD_MTU)\r
+#define DATA_OFFSET (sizeof(eth_hdr_t) - sizeof(ipoib_hdr_t))\r
+\r
+//#define IPOIB_CM_FLAG_RC (0x01) // RC flag\r
+//#define IPOIB_CM_FLAG_SVCID (0x01) // IETF bit\r
+#define IPOIB_CM_FLAG_RC (0x80) //OFED set RC flag this way\r
+#define IPOIB_CM_FLAG_SVCID (0x10) // OFED set IETF bit this way ( open OFED PR 1121 )\r
+\r
+/* Max send data segment list size. Segments are PAGE_SIZE each */\r
+/* + 2 to roundup( since fisrt and last segments could be partial pages )\r
+ + 1 reserved for ipoib header, add another 2 for IP and TCP headers */\r
+#define MAX_SEND_SGE (( MAX_CM_PAYLOAD_MTU >> PAGE_SHIFT ) + 5)\r
+\r
+/* Amount of physical memory to register. */\r
+#define MEM_REG_SIZE 0xFFFFFFFFFFFFFFFF\r
\r
+/* Number of work completions to chain for send and receive polling. */\r
+#define MAX_SEND_WC 8\r
+#define MAX_RECV_WC 16\r
\r
typedef struct _ipoib_globals\r
{\r
*********/\r
#include <complib/cl_packoff.h>\r
\r
+/* TODO: move this macro to inc\kernel\ip_packet.h*/\r
+#define ETH_IS_UNICAST(addr) \\r
+ !(BOOLEAN)(((PUCHAR)(addr))[0] & ((UCHAR)0x01))\r
\r
\r
#ifdef __cplusplus\r
ipoib_addr_get_flags(\r
IN const ipoib_hw_addr_t* const p_addr )\r
{\r
- return (uint8_t)(cl_ntoh32( p_addr->flags_qpn ) >> 24);\r
+ return (uint8_t)( p_addr->flags_qpn & 0x000000ff);\r
}\r
\r
static inline void\r
IN ipoib_hw_addr_t* const p_addr,\r
IN const uint8_t flags )\r
{\r
- p_addr->flags_qpn &= cl_ntoh32( 0xFFFFFF00 );\r
- p_addr->flags_qpn |= cl_ntoh32( flags );\r
+ p_addr->flags_qpn &= ( 0xFFFFFF00 );\r
+ p_addr->flags_qpn |= ( flags );\r
}\r
\r
static inline net32_t\r
ipoib_addr_get_qpn(\r
IN const ipoib_hw_addr_t* const p_addr )\r
{\r
- return cl_ntoh32( cl_ntoh32( p_addr->flags_qpn ) >> 8 );\r
+ return( ( p_addr->flags_qpn ) & 0xffffff00 );\r
}\r
\r
static inline void\r
IN ipoib_hw_addr_t* const p_addr,\r
IN const net32_t qpn )\r
{\r
- p_addr->flags_qpn = cl_ntoh32( (cl_ntoh32(\r
- p_addr->flags_qpn ) & 0x000000FF ) | (cl_ntoh32( qpn ) << 8) );\r
+ p_addr->flags_qpn &= ( 0x000000FF );\r
+ p_addr->flags_qpn |= qpn ;\r
}\r
\r
+static inline void\r
+ipoib_addr_set_sid(\r
+ IN net64_t* const p_sid,\r
+ IN const net32_t qpn )\r
+{\r
+ *p_sid = qpn;\r
+ *p_sid <<= 32;\r
+ *p_sid |= IPOIB_CM_FLAG_SVCID;\r
+}\r
\r
/****f* IPOIB/ipoib_mac_from_sst_guid\r
* NAME\r
{\r
const uint8_t *p_guid = (const uint8_t*)&port_guid;\r
uint32_t low24;\r
- net16_t guid_middle;\r
\r
/* Port guid is in network byte order. OUI is in lower 3 bytes. */\r
ASSERT( p_guid[0] == 0x00 && p_guid[1] == 0x02 && p_guid[2] == 0xc9 );\r
\r
- guid_middle = (net16_t)((port_guid & CL_HTON64( 0x000000ffff000000 )) >>24);\r
-\r
- if (guid_middle == 2) {\r
- p_mac_addr->addr[0] = 0;\r
- } else if (guid_middle == 3) {\r
- p_mac_addr->addr[0] = 2;\r
- } else {\r
+ if( (port_guid & CL_HTON64( 0x000000ffff000000 )) !=\r
+ CL_HTON64(0x0000000200000000))\r
+ {\r
return IB_INVALID_GUID;\r
}\r
+\r
low24 = ((uint32_t)cl_ntoh64( port_guid ) & 0x00FFFFFF);\r
\r
+ p_mac_addr->addr[0] = p_guid[0];\r
p_mac_addr->addr[1] = p_guid[1];\r
p_mac_addr->addr[2] = p_guid[2];\r
p_mac_addr->addr[3] = (uint8_t)(low24 >> 16);\r