<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.5512" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><FONT size=2>
<P>We come across a case, when Port type from Registry has not been 
read.</P></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Index: 
V:/svn/winib/trunk/hw/mlx4/kernel/bus/net/main.c<BR>===================================================================<BR>--- 
V:/svn/winib/trunk/hw/mlx4/kernel/bus/net/main.c (revision 5024)<BR>+++ 
V:/svn/winib/trunk/hw/mlx4/kernel/bus/net/main.c (revision 5025)<BR>@@ 
-274,10 +274,16 @@<BR>   if (port_type[i-1] & 
dev_cap->supported_port_types[i])<BR>    dev->caps.port_type[i] 
= port_type[i-1];<BR>   else {<BR>+   if 
(dev_cap->supported_port_types[i] & 
MLX4_PORT_TYPE_IB)<BR>+    dev->caps.port_type[i] = 
MLX4_PORT_TYPE_IB;<BR>+   else<BR>+    dev->caps.port_type[i] 

MLX4_PORT_TYPE_ETH;<BR>+<BR>    MLX4_PRINT_EV(TRACE_LEVEL_WARNING,MLX4_DBG_DRV 
,<BR>-    ("Requested port type %#x for port %d is 
"<BR>-    "not supported by HW. Supported %#x. We'll working 
to the supported one! \n", <BR>-    port_type[i-1], i, 
(int)dev_cap->supported_port_types[i]));<BR>+    ("Port 
%d: Unsupported requested port type %#x. We'll use #%x from supported %#x! \n", 
<BR>+    i, port_type[i-1], dev->caps.port_type[i], 
<BR>+    (int)dev_cap->supported_port_types[i]));<BR>+   <BR>    MLX4_PRINT_EV(TRACE_LEVEL_WARNING 
,MLX4_DBG_DRV ,<BR>     ("Ven %x Dev %d Fw %d.%d.%d, 
IsBurnDevice %s\n", 
<BR>     (unsigned)dev->pdev->ven_id, 
(unsigned)dev->pdev->dev_id,<BR>@@ -286,8 +292,6 
@@<BR>     (int) (dev->caps.fw_ver & 
0xffff),<BR>     mlx4_is_livefish(dev) ? "Y" : 
"N"<BR>     ));<BR>-   <BR>-   dev->caps.port_type[i] 

dev_cap->supported_port_types[i];<BR>   }<BR>   if 
(dev->caps.log_num_macs > dev_cap->log_max_macs[i]) 
{<BR>    dev->caps.log_num_macs = 
dev_cap->log_max_macs[i];<BR>Index: 
V:/svn/winib/trunk/hw/mlx4/kernel/bus/drv/drv.c<BR>===================================================================<BR>--- 
V:/svn/winib/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 5024)<BR>+++ 
V:/svn/winib/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 5025)<BR>@@ 
-276,28 +276,31 @@<BR> }<BR> <BR> BOOLEAN 
__read_setup_params(PUNICODE_STRING puvalue)<BR>-{    
<BR>-    NTSTATUS    status;    
<BR>-    WDFKEY hParamsKey = 
NULL;<BR>- DECLARE_CONST_UNICODE_STRING(KeyName, L"<A 
href="file://\\REGISTRY\\MACHINE\\SOFTWARE\\Mellanox">\\REGISTRY\\MACHINE\\SOFTWARE\\Mellanox</A>");<BR>+{<BR>+ NTSTATUS    
status;    <BR>+ WDFKEY hParamsKey = 
NULL;<BR>+ DECLARE_CONST_UNICODE_STRING(KeyName, L"<A 
href="file://\\Registry\\Machine\\SOFTWARE\\Mellanox">\\Registry\\Machine\\SOFTWARE\\Mellanox</A>");<BR>  DECLARE_CONST_UNICODE_STRING(PortType, 
L"PortType");<BR>-    <BR>+<BR>  status = 
WdfRegistryOpenKey(NULL, &KeyName, STANDARD_RIGHTS_ALL, 
WDF_NO_OBJECT_ATTRIBUTES, &hParamsKey);<BR>  if( !NT_SUCCESS( 
status ) ) <BR>-    {<BR>-  MLX4_PRINT( 
TRACE_LEVEL_ERROR  ,MLX4_DBG_DEV  ,("WdfRegistryOpenKey Failed status 
= 0x%x\n", status));<BR>-        return 
FALSE;<BR>+ {<BR>+  MLX4_PRINT( TRACE_LEVEL_WARNING  
,MLX4_DBG_DEV  ,<BR>+   ("WdfRegistryOpenKey(<A 
href="file://\\Registry\\Machine\\SOFTWARE\\Mellanox">\\Registry\\Machine\\SOFTWARE\\Mellanox</A>) 
Failed status = 0x%x\n", status));<BR>+  return 
FALSE;<BR>  }<BR>-    <BR>-    status = 
WdfRegistryQueryUnicodeString(hParamsKey, &PortType, NULL, 
puvalue);    <BR>+<BR>+ status = 
WdfRegistryQueryUnicodeString(hParamsKey, &PortType, NULL, 
puvalue);    <BR>  if( !NT_SUCCESS( status ) ) 
<BR>-    {<BR>-        
WdfRegistryClose(hParamsKey);<BR>-        
return FALSE;<BR>+ {<BR>+  MLX4_PRINT( TRACE_LEVEL_ERROR  
,MLX4_DBG_DEV  
,<BR>+   ("WdfRegistryQueryUnicodeString(PortType) Failed status 
= 0x%x\n", 
status));<BR>+  WdfRegistryClose(hParamsKey);<BR>+  return 
FALSE;<BR>  }<BR> <BR>-    
WdfRegistryClose(hParamsKey);    <BR>-    return 
TRUE;    
<BR>+ WdfRegistryClose(hParamsKey);    <BR>+ return 
TRUE;    <BR> }<BR> <BR> NTSTATUS<BR>@@ -306,7 
+309,7 @@<BR>  NTSTATUS status = STATUS_SUCCESS;<BR>  WDFKEY 
hKey = NULL;<BR>  WDFKEY hParamsKey = NULL;<BR>-    
BOOLEAN bRet = FALSE;<BR>+ BOOLEAN bRet = 
FALSE;<BR>  DECLARE_CONST_UNICODE_STRING(Parameters, 
L"Parameters");<BR>  DECLARE_CONST_UNICODE_STRING(PortType, 
L"PortType");<BR> <BR>@@ -316,31 +319,36 @@<BR>  uvalue.Buffer = 
uvalue_data;<BR>  uvalue.MaximumLength = 
MAX_UVALUE;<BR>  uvalue.Length = 0;<BR>-    
<BR>+<BR>+ // default values<BR>+ dev_params->mod_port_type[0] = 
MLX4_PORT_TYPE_IB;<BR>+ dev_params->mod_port_type[1] = 
MLX4_PORT_TYPE_IB;<BR>+<BR>  status = WdfDeviceOpenRegistryKey(Device, 
PLUGPLAY_REGKEY_DRIVER, <BR>   STANDARD_RIGHTS_ALL, 
WDF_NO_OBJECT_ATTRIBUTES, &hKey);<BR>  if( !NT_SUCCESS( status ) ) 
{<BR>-  MLX4_PRINT( TRACE_LEVEL_ERROR  ,MLX4_DBG_DEV  
,("WdfDeviceOpenRegistryKey Failed status = 0x%x\n", 
status));<BR>+  MLX4_PRINT( TRACE_LEVEL_ERROR  
,MLX4_DBG_DEV  ,<BR>+   ("WdfDeviceOpenRegistryKey(<A 
href="file://\\Registry\\Machine\\Control\\Class\\">\\Registry\\Machine\\Control\\Class\\</A>...) 
Failed status = 0x%x\n", status));<BR>   goto 
err;<BR>  }<BR> <BR>  status = WdfRegistryOpenKey(hKey, 
&Parameters, STANDARD_RIGHTS_ALL, WDF_NO_OBJECT_ATTRIBUTES, 
&hParamsKey);<BR>  if( !NT_SUCCESS( status ) ) 
{<BR>-  MLX4_PRINT( TRACE_LEVEL_ERROR  ,MLX4_DBG_DEV  
,("WdfRegistryOpenKey Failed status = 0x%x\n", 
status));<BR>+  MLX4_PRINT( TRACE_LEVEL_ERROR  
,MLX4_DBG_DEV  ,("WdfRegistryOpenKey(Prameters) Failed status = 0x%x\n", 
status));<BR>   goto 
err;<BR>  }<BR> <BR>-    bRet = 
__read_setup_params(&uvalue);<BR>-    if (bRet == 
TRUE)<BR>-    {<BR>-        
status = WdfRegistryAssignValue(hParamsKey, &PortType, 
REG_SZ,uvalue.Length,uvalue.Buffer);        
<BR>-        if( !NT_SUCCESS( status ) ) 
{<BR>-            
MLX4_PRINT( TRACE_LEVEL_ERROR  ,MLX4_DBG_DEV  
,("WdfRegistryAssignValue Failed status = 0x%x\n", 
status));<BR>-            
goto err;<BR>-        
}        
<BR>-        uvalue.Length = 
0;<BR>-    }<BR>-    <BR>+ bRet = 
__read_setup_params(&uvalue);<BR>+ if (bRet == 
TRUE)<BR>+ {<BR>+  status = WdfRegistryAssignValue(hParamsKey, 
&PortType, 
REG_SZ,uvalue.Length,uvalue.Buffer);        
<BR>+  if( !NT_SUCCESS( status ) ) {<BR>+   MLX4_PRINT( 
TRACE_LEVEL_ERROR  ,MLX4_DBG_DEV  ,("WdfRegistryAssignValue(PortType) 
Failed status = 0x%x\n", status));<BR>+   goto 
err;<BR>+  }<BR>+  uvalue.Length = 
0;<BR>+ }<BR>+<BR>  status = 
WdfRegistryQueryUnicodeString(hParamsKey, &PortType, NULL, 
&uvalue);<BR>  if (NT_SUCCESS (status)) {<BR>   if 
(!wcscmp(uvalue_data, L"ib,ib")) {<BR>@@ -360,10 +368,6 
@@<BR>    dev_params->mod_port_type[1] = 
MLX4_PORT_TYPE_ETH;<BR>   }<BR>  }<BR>- else 
{<BR>-  dev_params->mod_port_type[0] = 
MLX4_PORT_TYPE_IB;<BR>-  dev_params->mod_port_type[1] = 
MLX4_PORT_TYPE_IB;<BR>- }<BR> <BR> err:<BR>  if (hKey 
!= NULL) <BR></DIV></FONT></BODY></HTML>