<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD>
<BODY>
<DIV><FONT size=2 face=Arial><SPAN class=889280116-16092009>This patch allows
WSD to use basic support for APM. (no fail back support)</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=889280116-16092009></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=889280116-16092009>The patch assumes
that the two machines that are talking can reach other on both
ports.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=889280116-16092009></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=889280116-16092009>In order to activate
APM one has to set the following environment variable on both
sides:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=889280116-16092009></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=889280116-16092009>set
IBWSD_USE_APM=1</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=889280116-16092009></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=889280116-16092009>Thanks</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=889280116-16092009>Tzachi</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=889280116-16092009></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=889280116-16092009></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Index:
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibspdll.h<BR>===================================================================<BR>---
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibspdll.h (revision
4824)<BR>+++
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibspdll.h (revision
4825)<BR>@@ -66,7 +66,9 @@<BR> /* Allow users to control SA timeouts
behavior - fall back on IPoIB or fail. */<BR> extern
int g_connect_err;<BR> extern
uint8_t g_max_cm_retries;<BR>-extern
uint8_t g_pkt_life_modifier;<BR>+extern
int8_t g_pkt_life_modifier;<BR> extern
uint8_t g_qp_retries;<BR>+extern
uint8_t g_use_APM;<BR> <BR>+<BR> #endif /* IBSPDLL_H
*/<BR>Index:
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ib_cm.c<BR>===================================================================<BR>---
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ib_cm.c (revision
4824)<BR>+++
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ib_cm.c (revision
4825)<BR>@@ -745,7 +745,9
@@<BR> int<BR> ib_connect(<BR> IN struct
ibsp_socket_info *socket_info,<BR>- IN ib_path_rec_t *path_rec
)<BR>+ IN ib_path_rec_t *path_rec,
<BR>+ IN ib_path_rec_t *alt_path_rec
)<BR>+<BR> {<BR> ib_cm_req_t
cm_req;<BR> ib_api_status_t status;<BR>@@ -773,6 +775,7
@@<BR> cm_req.svc_id = get_service_id_for_port(
socket_info->peer_addr.sin_port );<BR> cm_req.max_cm_retries =
g_max_cm_retries;<BR> cm_req.p_primary_path =
path_rec;<BR>+ cm_req.p_alt_path =
alt_path_rec;<BR> cm_req.pfn_cm_rep_cb =
cm_rep_callback;<BR> <BR> cm_req.p_req_pdata = (uint8_t *) &
params;<BR>@@ -814,7 +817,6 @@<BR> cm_req.rnr_nak_timeout =
QP_ATTRIB_RNR_NAK_TIMEOUT;<BR> cm_req.rnr_retry_cnt =
QP_ATTRIB_RNR_RETRY;<BR> cm_req.retry_cnt =
g_qp_retries;<BR>- cm_req.p_alt_path =
NULL;<BR> cm_req.pfn_cm_mra_cb =
cm_mra_callback;<BR> cm_req.pfn_cm_rej_cb =
cm_rej_callback;<BR> <BR>@@ -884,7 +886,7
@@<BR> #endif<BR> cm_rep.init_depth =
QP_ATTRIB_INITIATOR_DEPTH;<BR> cm_rep.target_ack_delay =
10;<BR>- cm_rep.failover_accepted =
IB_FAILOVER_ACCEPT_UNSUPPORTED;<BR>+ cm_rep.failover_accepted = g_use_APM ?
IB_FAILOVER_ACCEPT_SUCCESS :
IB_FAILOVER_ACCEPT_UNSUPPORTED;<BR> cm_rep.flow_ctrl =
cm_req_received->flow_ctrl;<BR> cm_rep.rnr_nak_timeout =
QP_ATTRIB_RNR_NAK_TIMEOUT;<BR> cm_rep.rnr_retry_cnt =
cm_req_received->rnr_retry_cnt;<BR>Index:
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibsp_ip.c<BR>===================================================================<BR>---
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibsp_ip.c (revision
4824)<BR>+++
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibsp_ip.c (revision
4825)<BR>@@ -347,8 +347,9 @@<BR> /* Synchronously query the SA for a GUID.
Return 0 on success.
*/<BR> int<BR> query_pr(<BR>- IN struct
ibsp_port *port,<BR>+ IN ib_net64_t guid,<BR> IN ib_net64_t dest_port_guid,<BR>+ IN uint16_t dev_id,<BR> OUT ib_path_rec_t *path_rec
)<BR> {<BR> ib_gid_pair_t user_query;<BR>@@ -362,14 +363,14
@@<BR> <BR> query_req.query_type =
IB_QUERY_PATH_REC_BY_GIDS;<BR> query_req.p_query_input =
&user_query;<BR>- query_req.port_guid =
port->guid;<BR>+ query_req.port_guid =
guid;<BR> query_req.timeout_ms =
g_sa_timeout;<BR> query_req.retry_cnt =
g_sa_retries;<BR> query_req.flags =
IB_FLAGS_SYNC;<BR> query_req.query_context =
&query_context;<BR> query_req.pfn_query_cb =
query_pr_callback;<BR> <BR>- ib_gid_set_default(
&user_query.src_gid, port->guid );<BR>+ ib_gid_set_default(
&user_query.src_gid, guid );<BR> ib_gid_set_default(
&user_query.dest_gid, dest_port_guid
);<BR> <BR> query_context.path_rec = path_rec;<BR>@@ -379,7
+380,7 @@<BR> <BR> IBSP_PRINT(TRACE_LEVEL_INFORMATION,
IBSP_DBG_HW,<BR> ("Query for path from %I64x to
%I64x\n",<BR>- port->guid, dest_port_guid) );<BR>+ guid
, dest_port_guid) );<BR> <BR> status = ib_query(
g_ibsp.al_handle, &query_req, &query_handle );<BR> <BR>@@ -398,7
+399,7 @@<BR> goto
error;<BR> }<BR> <BR>- if( (port->hca->dev_id ==
0x5A44) &&<BR>+ if( (dev_id == 0x5A44)
&&<BR> (ib_path_rec_mtu( path_rec ) >
IB_MTU_LEN_1024) )<BR> {<BR> /* Local endpoint is
Tavor - cap MTU to 1K for extra bandwidth. */<BR>@@ -406,7 +407,7
@@<BR> path_rec->mtu |=
IB_MTU_LEN_1024;<BR> }<BR> <BR>- pkt_life =
ib_path_rec_pkt_life( path_rec ) + g_pkt_life_modifier;<BR>+ pkt_life =
ib_path_rec_pkt_life( path_rec ) + g_pkt_life_modifier;<BR> if(
pkt_life > 0x1F )<BR> pkt_life = 0x1F;<BR> <BR>Index:
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibspproto.h<BR>===================================================================<BR>---
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibspproto.h (revision
4824)<BR>+++
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibspproto.h (revision
4825)<BR>@@ -165,9 +165,10
@@<BR> <BR> int<BR> query_pr(<BR>- IN struct
ibsp_port *port,<BR>+ IN ib_net64_t guid,<BR> IN ib_net64_t dest_port_guid,<BR>- OUT ib_path_rec_t *path_rec
);<BR>+ IN uint16_t dev_id,<BR>+ OUT ib_path_rec_t *path_rec
);<BR> <BR> int<BR> build_ip_list(<BR>@@ -201,7 +202,8
@@<BR> int<BR> ib_connect(<BR> IN struct
ibsp_socket_info *socket_info,<BR>- IN ib_path_rec_t *path_rec
);<BR>+ IN ib_path_rec_t *path_rec,
<BR>+ IN ib_path_rec_t *alt_path_rec
);<BR> <BR> void<BR> ib_disconnect(<BR>@@ -296,3 +298,10
@@<BR> <BR> extern void<BR> release_globals( void
);<BR>+<BR>+inline ib_net64_t GetOtherPortGuid(ib_net64_t
DestPortGuid)<BR>+{<BR>+ return DestPortGuid ^
0x300000000000000;<BR>+<BR>+}<BR>+<BR>Index:
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibsp_duplicate.c<BR>===================================================================<BR>---
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibsp_duplicate.c (revision
4824)<BR>+++
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibsp_duplicate.c (revision
4825)<BR>@@ -75,6 +75,7 @@<BR> struct ibsp_duplicate_info
*dup_info;<BR> ib_net64_t
dest_port_guid;<BR> ib_path_rec_t path_rec;<BR>+ ib_path_rec_t
alt_path_rec, *palt_path_rec = NULL;<BR> <BR> IBSP_ENTER(
IBSP_DBG_DUP );<BR> <BR>@@ -118,7 +119,7
@@<BR> }<BR> <BR> /* Get the path record
*/<BR>- ret = query_pr( socket_info->port, dest_port_guid, &path_rec
);<BR>+ ret = query_pr( socket_info->port->guid, dest_port_guid,
socket_info->port->hca->dev_id, &path_rec );<BR> if( ret
)<BR> {<BR> IBSP_ERROR( ("query_pr failed for IP
%08x\n",<BR>@@ -126,7 +127,22 @@<BR> ret =
WSAENETDOWN;<BR> goto err1;<BR> }<BR>+ /* Get
the alternate path record */<BR>+ if (g_use_APM)
<BR>+ {<BR>+ ret =
query_pr(GetOtherPortGuid(socket_info->port->guid),
GetOtherPortGuid(dest_port_guid), socket_info->port->hca->dev_id,
&alt_path_rec );<BR>+ if( ret
)<BR>+ { <BR>+ // We can ignore a failure here,
since APM is not a MUST<BR>+ IBSP_ERROR( ("QPR for alternate
path failed (error ignored)\n") );<BR>+ }<BR>+ else
<BR>+ {<BR>+ palt_path_rec =
&alt_path_rec;<BR>+ }<BR>+ }<BR> <BR>+<BR> IBSP_CHANGE_SOCKET_STATE(
socket_info, IBSP_DUPLICATING_NEW );<BR> socket_info->h_event =
CreateEvent( NULL, FALSE, FALSE, NULL );<BR> if(
!socket_info->h_event )<BR>@@ -143,7 +159,7
@@<BR> }<BR> <BR> /* Connects the QP.
*/<BR>- ret = ib_connect( socket_info, &path_rec );<BR>+ ret =
ib_connect( socket_info, &path_rec, palt_path_rec );<BR> if( ret
!= WSAEWOULDBLOCK )<BR> {<BR> IBSP_ERROR(
("ib_connect failed (%d)\n", ret) );<BR>Index:
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibspdll.c<BR>===================================================================<BR>---
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibspdll.c (revision
4824)<BR>+++
Q:/projMLNX_WinOF_2.0/MLNX_WinOF_2-0/ulp/wsd/user/ibspdll.c (revision
4825)<BR>@@ -65,8 +65,9 @@<BR> uint32_t g_sa_retries =
4;<BR> int g_connect_err =
WSAEADDRNOTAVAIL;<BR> uint8_t g_max_cm_retries =
CM_RETRIES;<BR>-uint8_t g_pkt_life_modifier =
0;<BR>+int8_t g_pkt_life_modifier =
0;<BR> uint8_t g_qp_retries =
QP_ATTRIB_RETRY_COUNT;<BR>+uint8_t g_use_APM =
0;<BR> DWORD_PTR g_dwPollThreadAffinityMask =
0;<BR> <BR> uint32_t g_ibsp_dbg_level =
TRACE_LEVEL_ERROR;<BR>@@ -205,7 +206,7 @@<BR> i =
GetEnvironmentVariable( "IBWSD_PKT_LIFE", env_var, sizeof(env_var)
);<BR> if( i && i <= 16
)<BR> {<BR>- g_pkt_life_modifier =
(uint8_t)_tcstoul( env_var, NULL, 0 );<BR>+ g_pkt_life_modifier
= (int8_t)_tcstoul( env_var, NULL, 0 );<BR> if(
g_pkt_life_modifier > 0x1F
)<BR> g_pkt_life_modifier =
0x1F;<BR> }<BR>@@ -218,6 +219,12
@@<BR> g_qp_retries =
7;<BR> }<BR> <BR>+ i = GetEnvironmentVariable(
"IBWSD_USE_APM", env_var, sizeof(env_var) );<BR>+ if( i && i
<= 16 )<BR>+ {<BR>+ g_use_APM =
(uint8_t)_tcstoul( env_var, NULL, 0
);<BR>+ }<BR>+<BR> if( init_globals()
)<BR> return FALSE;<BR> <BR>@@ -804,7 +811,9
@@<BR> int ret;<BR> ib_net64_t
dest_port_guid;<BR> ib_path_rec_t path_rec;<BR>+ ib_path_rec_t
alt_path_rec, *palt_path_rec = NULL;<BR> <BR>+<BR> IBSP_ENTER(
IBSP_DBG_CONN );<BR> <BR> UNUSED_PARAM( lpCalleeData );<BR>@@
-875,7 +884,7 @@<BR> }<BR> <BR> /* Get the path
record */<BR>- ret = query_pr( socket_info->port, dest_port_guid,
&path_rec );<BR>+ ret = query_pr( socket_info->port->guid,
dest_port_guid,socket_info->port->hca->dev_id, &path_rec
);<BR> if( ret
)<BR> {<BR> IBSP_ERROR_EXIT( (<BR>@@ -883,6 +892,21
@@<BR> *lpErrno = g_connect_err;<BR> return
SOCKET_ERROR;<BR> }<BR>+ /* Get the alternate path record
*/<BR>+ if (g_use_APM) <BR>+ {<BR>+ ret =
query_pr(GetOtherPortGuid(socket_info->port->guid),
GetOtherPortGuid(dest_port_guid), socket_info->port->hca->dev_id,
&alt_path_rec );<BR>+ if( ret
)<BR>+ { <BR>+ // We can ignore a failure here,
since APM is not a MUST<BR>+ IBSP_ERROR( ("QPR for alternate
path failed (error ignored)\n") );<BR>+ }<BR>+ else
<BR>+ {<BR>+ palt_path_rec =
&alt_path_rec;<BR>+ }<BR>+ }<BR>+ <BR> <BR> cl_spinlock_acquire(
&socket_info->mutex1 );<BR> <BR>@@ -924,7 +948,7
@@<BR> IBSP_CHANGE_SOCKET_STATE( socket_info, IBSP_CONNECT
);<BR> <BR> /* Connect */<BR>- *lpErrno = ib_connect(
socket_info, &path_rec );<BR>+ *lpErrno = ib_connect( socket_info,
&path_rec, palt_path_rec );<BR> if( *lpErrno != WSAEWOULDBLOCK
)<BR> {<BR> /* We must be sure none destroyed our
socket */<BR></DIV></FONT></BODY></HTML>