<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=320391018-01112008><FONT face=Arial color=#0000ff
size=2>Applied on 1717/8.</FONT></SPAN></DIV>
<DIV><SPAN class=320391018-01112008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=320391018-01112008><FONT face=Arial color=#0000ff
size=2>Thanks</FONT></SPAN></DIV>
<DIV><SPAN class=320391018-01112008><FONT face=Arial color=#0000ff
size=2>Tzachi</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> ofw-bounces@lists.openfabrics.org
[mailto:ofw-bounces@lists.openfabrics.org] <B>On Behalf Of </B>Tzachi
Dar<BR><B>Sent:</B> Thursday, October 30, 2008 12:52 PM<BR><B>To:</B>
ofw@lists.openfabrics.org<BR><B>Subject:</B> [ofw] Patch: Fix using lists on
ipoib without locks<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2><SPAN class=656375010-30102008>This is the
(hopefully) final version of this patch, that was already sent to community in
the past.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=656375010-30102008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=656375010-30102008>Thanks</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=656375010-30102008>Tzachi</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=656375010-30102008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=656375010-30102008>Index:
ulp/ipoib/kernel/ipoib_port.c<BR>===================================================================<BR>---
ulp/ipoib/kernel/ipoib_port.c (revision 1712)<BR>+++
ulp/ipoib/kernel/ipoib_port.c (working copy)<BR>@@ -495,8 +495,6
@@<BR> <BR> inline void ipoib_port_deref(ipoib_port_t * p_port, int
type)<BR> {<BR>- cl_obj_deref( &p_port->obj
);<BR>-<BR> #if DBG<BR> cl_atomic_dec(
&p_port->ref[type % ref_mask] );<BR> IPOIB_PRINT(
TRACE_LEVEL_INFORMATION, IPOIB_DBG_OBJ,<BR>@@ -504,6 +502,8
@@<BR> #else<BR> UNREFERENCED_PARAMETER(type);<BR> #endif<BR>+ cl_obj_deref(
&p_port->obj );<BR>+<BR> }<BR> <BR> /* function returns
pointer to payload that is going after IP header.<BR>@@ -3954,15 +3954,15
@@<BR> <BR> p_desc->wr.ds_array =
p_desc->local_ds;<BR> <BR>- p_desc->wr.dgrm.ud.remote_qp =
p_desc->p_endpt->qpn;<BR>+ p_desc->wr.dgrm.ud.remote_qp =
p_desc->p_endpt1->qpn;<BR> p_desc->wr.dgrm.ud.remote_qkey
= p_port->ib_mgr.bcast_rec.qkey;<BR>- p_desc->wr.dgrm.ud.h_av =
p_desc->p_endpt->h_av;<BR>+ p_desc->wr.dgrm.ud.h_av =
p_desc->p_endpt1->h_av;<BR> p_desc->wr.dgrm.ud.pkey_index
= p_port->pkey_index;<BR> p_desc->wr.dgrm.ud.rsvd =
NULL;<BR> <BR> /* Store context in our reserved area of the
packet. */<BR> IPOIB_PORT_FROM_PACKET( p_desc->p_pkt ) =
p_port;<BR>- IPOIB_ENDPT_FROM_PACKET( p_desc->p_pkt ) =
p_desc->p_endpt;<BR>+ IPOIB_ENDPT_FROM_PACKET( p_desc->p_pkt ) =
p_desc->p_endpt1;<BR> IPOIB_SEND_FROM_PACKET( p_desc->p_pkt )
= p_desc->p_buf;<BR> <BR> IPOIB_EXIT( IPOIB_DBG_SEND
);<BR>@@ -3983,8 +3983,8 @@<BR> p_desc->p_pkt, status
);<BR> ipoib_inc_send_stat( p_port->p_adapter, IP_STAT_ERROR, 0
);<BR> /* Deref the endpoint. */<BR>- if( p_desc->p_endpt
)<BR>- ipoib_endpt_deref( p_desc->p_endpt );<BR>+ if(
p_desc->p_endpt1 )<BR>+ ipoib_endpt_deref( p_desc->p_endpt1
);<BR> <BR> if( p_desc->p_buf )<BR> {<BR>@@
-4044,7 +4044,7 @@<BR> for( i = 0; i < num_packets; i++
)<BR> {<BR> desc.p_pkt =
p_packet_array[i];<BR>- desc.p_endpt =
NULL;<BR>+ desc.p_endpt1 = NULL;<BR> desc.p_buf =
NULL;<BR> <BR> /* Get the ethernet header so we can find
the endpoint. */<BR>@@ -4107,7 +4107,7
@@<BR> p_eth_hdr->dst.addr[3] = ((unsigned
char*)&p_ip_hdr->dst_ip)[1];<BR> }<BR> h_end:<BR>- status
= __send_mgr_queue( p_port, p_eth_hdr, &desc.p_endpt
);<BR>+ status = __send_mgr_queue( p_port, p_eth_hdr,
&desc.p_endpt1 );<BR> cl_perf_stop(
&p_port->p_adapter->perf, SendMgrQueue );<BR> if(
status == NDIS_STATUS_PENDING )<BR> {<BR>@@ -4216,7 +4216,7
@@<BR> <BR> desc.p_pkt =
IPOIB_PACKET_FROM_LIST_ITEM(<BR> cl_qlist_remove_head(
&p_port->send_mgr.pending_list ) );<BR>- desc.p_endpt =
NULL;<BR>+ desc.p_endpt1 = NULL;<BR> desc.p_buf =
NULL;<BR> <BR> /* Get the ethernet header so we can find
the endpoint. */<BR>@@ -4231,10 +4231,11
@@<BR> }<BR> <BR> cl_perf_start(
GetEndpt );<BR>- status = __endpt_mgr_ref( p_port,
p_eth_hdr->dst, &desc.p_endpt );<BR>+ status =
__endpt_mgr_ref( p_port, p_eth_hdr->dst, &desc.p_endpt1
);<BR> cl_perf_stop( &p_port->p_adapter->perf,
GetEndpt );<BR> if( status == NDIS_STATUS_PENDING
)<BR> {<BR>+ CL_ASSERT(desc.p_endpt1 ==
NULL);<BR> cl_qlist_insert_head(
&p_port->send_mgr.pending_list,<BR> IPOIB_LIST_ITEM_FROM_PACKET(
desc.p_pkt ) );<BR> break;<BR>@@ -4242,6 +4243,7
@@<BR> else if( status != NDIS_STATUS_SUCCESS
)<BR> {<BR> ASSERT( status ==
NDIS_STATUS_NO_ROUTE_TO_DESTINATION
);<BR>+ CL_ASSERT(desc.p_endpt1 ==
NULL);<BR> <BR> if( ETH_IS_MULTICAST(
p_eth_hdr->dst.addr ) )<BR> {<BR>@@ -4549,10
+4551,10 @@<BR> <BR> if( p_port->p_local_endpt
)<BR> {<BR>+ cl_fmap_remove_item(
&p_port->endpt_mgr.gid_endpts,<BR>+ &p_port->p_local_endpt->gid_item
);<BR> cl_qmap_remove_item(
&p_port->endpt_mgr.mac_endpts,<BR> &p_port->p_local_endpt->mac_item
);<BR>- cl_fmap_remove_item(
&p_port->endpt_mgr.gid_endpts,<BR>- &p_port->p_local_endpt->gid_item
);<BR> cl_qmap_remove_item(
&p_port->endpt_mgr.lid_endpts,<BR> &p_port->p_local_endpt->lid_item
);<BR> <BR>@@ -4618,8 +4620,10 @@<BR> /* Destroy
all multicast endpoints now that we have released the lock.
*/<BR> while( cl_qlist_count( &mc_list )
)<BR> {<BR>- cl_obj_destroy( &PARENT_STRUCT(
cl_qlist_remove_head( &mc_list ),<BR>- ipoib_endpt_t,
mac_item.pool_item.list_item )->obj
);<BR>+ cl_list_item_t *p_item;<BR>+ p_item =
cl_qlist_remove_head( &mc_list );<BR>+ p_endpt =
PARENT_STRUCT(p_item, ipoib_endpt_t,
mac_item.pool_item.list_item);<BR>+ cl_obj_destroy(
&p_endpt->obj);<BR> }<BR> <BR> IPOIB_EXIT(
IPOIB_DBG_ENDPT );<BR>@@ -4639,8 +4643,11
@@<BR> {<BR> IPOIB_ENTER( IPOIB_DBG_ENDPT
);<BR> <BR>+ /* This function must be called from the recieve path
*/<BR>+ CL_ASSERT(p_port->endpt_rdr >
0);<BR>+<BR> cl_obj_lock( &p_port->obj );<BR>- /* Wait
for all readers to complete. */<BR>+ /* Wait for all readers to complete.
*/ <BR> while( p_port->endpt_rdr > 1
)<BR> ;<BR> <BR>@@ -5709,14 +5716,21
@@<BR> IPOIB_EXIT( IPOIB_DBG_INIT
);<BR> return;<BR> }<BR>- cl_obj_unlock(
&p_port->obj );<BR> p_port->bc_join_retry_cnt =
0;<BR>+<BR>+ while( p_port->endpt_rdr
)<BR>+ {<BR>+ cl_obj_unlock( &p_port->obj
);<BR>+ cl_obj_lock( &p_port->obj
);<BR>+ }<BR>+<BR> if(!
p_port->p_local_endpt)<BR> {<BR> ib_port_info_t port_info;<BR> cl_memclr(&port_info,
sizeof(port_info));<BR> port_info.base_lid =
p_port->base_lid;<BR> status = __endpt_mgr_add_local(
p_port, &port_info );<BR>+ cl_obj_unlock( &p_port->obj
);<BR> if( status != IB_SUCCESS
)<BR> {<BR> IPOIB_PRINT(
TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,<BR>@@ -5725,6 +5739,9
@@<BR> goto
err;<BR> }<BR> }<BR>+<BR>+ cl_obj_unlock(
&p_port->obj );<BR>+<BR> status = __endpt_mgr_add_bcast(
p_port, p_mcast_rec );<BR> if( status != IB_SUCCESS
)<BR> {<BR>@@ -5991,6 +6008,11 @@<BR> p_port =
(ipoib_port_t*)p_mcast_rec->mcast_context;<BR> <BR> cl_obj_lock(
&p_port->obj );<BR>+ while( p_port->endpt_rdr
)<BR>+ {<BR>+ cl_obj_unlock( &p_port->obj
);<BR>+ cl_obj_lock( &p_port->obj
);<BR>+ }<BR> if( p_port->state != IB_QPS_RTS
)<BR> {<BR> cl_obj_unlock( &p_port->obj
);<BR>@@ -6005,10 +6027,10 @@<BR> ("Invalid state -
Aborting.\n")
);<BR> return;<BR> }<BR>- cl_obj_unlock(
&p_port->obj );<BR> <BR> if( p_mcast_rec->status !=
IB_SUCCESS )<BR> {<BR>+ cl_obj_unlock(
&p_port->obj );<BR> IPOIB_PRINT( TRACE_LEVEL_ERROR,
IPOIB_DBG_ERROR,<BR> ("Multicast join request failed
with status
%s.\n",<BR> p_port->p_adapter->p_ifc->get_err_str(
p_mcast_rec->status )) );<BR>@@ -6019,7 +6041,6
@@<BR> return;<BR> }<BR> <BR>- cl_obj_lock(
&p_port->obj );<BR> p_item =
cl_fmap_get(<BR> &p_port->endpt_mgr.gid_endpts,
&p_mcast_rec->p_member_rec->mgid );<BR> if( p_item ==
cl_fmap_end( &p_port->endpt_mgr.gid_endpts ) )<BR>@@ -6065,6 +6086,9
@@<BR> */<BR> if( p_endpt->dlid
)<BR> {<BR>+ while( p_port->endpt_rdr
)<BR>+ ;<BR>+ <BR> p_qitem
=
cl_qmap_insert(<BR> &p_port->endpt_mgr.lid_endpts,
p_endpt->dlid, &p_endpt->lid_item );<BR> CL_ASSERT(
p_qitem == &p_endpt->lid_item );<BR>@@ -6294,6 +6318,12
@@<BR> cl_qlist_init( &destroy_mc_list
);<BR> <BR> cl_obj_lock( &p_port->obj );<BR>+ /*
Wait for all readers to finish */<BR>+ while( p_port->endpt_rdr
)<BR>+ {<BR>+ cl_obj_unlock( &p_port->obj
);<BR>+ cl_obj_lock( &p_port->obj
);<BR>+ }<BR> cnt = 0;<BR> p_item = cl_qmap_head(
&p_port->endpt_mgr.mac_endpts );<BR> while( (p_item !=
cl_qmap_end( &p_port->endpt_mgr.mac_endpts )) && (cnt <
GC_MAX_LEAVE_NUM))<BR>@@ -6332,7 +6362,7 @@<BR> /* Destroy all
multicast endpoints now that we have released the lock.
*/<BR> while( cl_qlist_count( &destroy_mc_list )
)<BR> {<BR>- p_endpt = PARENT_STRUCT( cl_qlist_head(
&destroy_mc_list ),<BR>+ p_endpt = PARENT_STRUCT(
cl_qlist_remove_head( &destroy_mc_list
),<BR> ipoib_endpt_t,
mac_item.pool_item.list_item );<BR> IPOIB_PRINT(
TRACE_LEVEL_INFORMATION, IPOIB_DBG_ENDPT,<BR> ("mcast
garbage collector: destroying endpoint %02x:%02x:%02x:%02x:%02x:%02x \n",
<BR>@@ -6342,9 +6372,7 @@<BR>
p_endpt->mac.addr[3],<BR>
p_endpt->mac.addr[4],<BR>
p_endpt->mac.addr[5]) );<BR>-<BR>- cl_obj_destroy(
&PARENT_STRUCT( cl_qlist_remove_head( &destroy_mc_list
),<BR>- ipoib_endpt_t, mac_item.pool_item.list_item )->obj
);<BR>+ cl_obj_destroy( &p_endpt->obj
);<BR> }<BR> }<BR> <BR>Index:
ulp/ipoib/kernel/ipoib_port.h<BR>===================================================================<BR>---
ulp/ipoib/kernel/ipoib_port.h (revision 1711)<BR>+++
ulp/ipoib/kernel/ipoib_port.h (working copy)<BR>@@ -378,7 +378,7
@@<BR> typedef struct
_ipoib_send_desc<BR> {<BR> NDIS_PACKET *p_pkt;<BR>- ipoib_endpt_t *p_endpt;<BR>+ ipoib_endpt_t *p_endpt1;<BR> send_buf_t *p_buf;<BR> ib_send_wr_t wr;<BR> ipoib_hdr_t pkt_hdr;<BR></SPAN></FONT></DIV></BLOCKQUOTE></BODY></HTML>