[Openib-windows] [PATCH] IpoIB client

Yossi Leybovich sleybo at mellanox.co.il
Mon Apr 24 10:03:01 PDT 2006


Fab 

I talked with on of our Linux guys and he said that Linux handle the
reregister situation by clearing the av from the endpnt.

So I made patch that upon port_down just clear the av from all endpt
(the function endpt_mgr_clear_all.
I had to handle 2 cases where we insert endpt with AV (mcast and local)
, so I delete the former endpt and insert the new one.
I tried it and it works fine, the ping cont. after short delay.

I can see many  advantages in this approach
1. We keep the MAC constant during SM change.
2. No need to delete the ARP table at the host.
3. We keep the same behavior like all other Ethernet NIC.

For consistency I move the adapter->state to INIT just before calling to
port_up in the SM_CHANGE event (same as we do in ACTIVE event).
I assume that while we doing port_up we want to keep the a_dapter->state
in INIT state.

I tested the patch on mthca with check version (so all assert were
enable)
This patch was tested upon the former 2 fixes that I sent you.
I see much more stability with these fixes both when I restart the SM
from time to time and also in case were port move from down to active
(No extra SM_CHANEG events, although the SM_CHANGE event fired before
the ACTIVE event so there is still race here)

Pls note that the patch include some more changes that I made (mostly
prints )
So use it as reference and change what you think.


Yossi 


--- W:\work\clean\ulp\ipoib\kernel\ipoib_port.c	Mon Apr 24 19:13:03 2006
+++ W:\work\OpenIB\ulp\ipoib\kernel\ipoib_port.c	Thu Apr 20
09:30:15 2006
@@ -652,7 +652,6 @@
 	p_port = PARENT_STRUCT( p_obj, ipoib_port_t, obj );
 
 	ipoib_port_down( p_port );
-	__endpt_mgr_remove_all( p_port);
 
 	IPOIB_EXIT( IPOIB_DBG_INIT );
 }
@@ -3874,7 +3873,7 @@
 	cl_map_item_t	*p_item;
 	ipoib_endpt_t	*p_endpt;
 
-	IPOIB_ENTER( IPOIB_DBG_ERROR );
+	IPOIB_ENTER( IPOIB_DBG_ENDPT );
 	
 	cl_obj_lock( &p_port->obj );
 	/* Wait for all readers to complete. */
@@ -3897,38 +3896,7 @@
 	cl_fmap_remove_all( &p_port->endpt_mgr.gid_endpts );
 	cl_obj_unlock( &p_port->obj );
 
-	IPOIB_EXIT( IPOIB_DBG_ERROR  );
-}
-
-
-static void
-__endpt_mgr_clear_all(
-	IN				ipoib_port_t* const
p_port )
-{
-	cl_map_item_t	*p_item;
-	ipoib_endpt_t	*p_endpt;
-
-	IPOIB_ENTER( IPOIB_DBG_ERROR  );
-	
-	cl_obj_lock( &p_port->obj );
-	/* Wait for all readers to complete. */
-	while( p_port->endpt_rdr )
-		;
-
-	p_item = cl_qmap_head( &p_port->endpt_mgr.mac_endpts );
-	while( p_item != cl_qmap_end( &p_port->endpt_mgr.mac_endpts ) )
-	{
-		p_endpt = PARENT_STRUCT( p_item, ipoib_endpt_t, mac_item
);
-		p_endpt->h_av = NULL;
-		p_item = cl_qmap_next( p_item );
-
-	}
-	
-	//cl_qmap_remove_all( &p_port->endpt_mgr.lid_endpts );
-	//cl_fmap_remove_all( &p_port->endpt_mgr.gid_endpts );
-	cl_obj_unlock( &p_port->obj );
-
-	IPOIB_EXIT( IPOIB_DBG_ERROR );
+	IPOIB_EXIT( IPOIB_DBG_ENDPT );
 }
 
 
@@ -4218,7 +4186,6 @@
 {
 	ib_api_status_t	status;
 	ipoib_endpt_t	*p_endpt;
-	ipoib_endpt_t	*p_old_endpt;
 	mac_addr_t		bcast_mac;
 
 	IPOIB_ENTER( IPOIB_DBG_INIT );
@@ -4251,11 +4218,6 @@
 
 	/* Add the broadcast endpoint to the enpoint map. */
 	cl_memset( &bcast_mac, 0xFF, sizeof(bcast_mac) );
-	p_old_endpt = __endpt_mgr_get_by_gid(p_port,
&p_mcast_rec->p_member_rec->mgid);
-	if(p_old_endpt)
-	{
-		__endpt_mgr_remove( p_port, p_old_endpt );
-	}
 	__endpt_mgr_insert_locked( p_port, bcast_mac, p_endpt );
 
 	IPOIB_EXIT( IPOIB_DBG_INIT );
@@ -4437,7 +4399,6 @@
 	ib_api_status_t			status;
 	ib_gid_t				gid;
 	ipoib_endpt_t			*p_endpt;
-	ipoib_endpt_t			*p_old_endpt;
 	ib_av_attr_t			av_attr;
 
 	IPOIB_ENTER( IPOIB_DBG_INIT );
@@ -4469,11 +4430,7 @@
 			p_port->p_adapter->p_ifc->get_err_str( status ))
);
 		return status;
 	}
-	p_old_endpt = __endpt_mgr_get_by_gid(p_port, &gid);
-	if(p_old_endpt)
-	{
-		__endpt_mgr_remove( p_port, p_old_endpt );
-	}
+
 	__endpt_mgr_insert_locked( p_port, p_port->p_adapter->mac,
p_endpt );
 
 	p_port->p_local_endpt = p_endpt;
@@ -4874,8 +4831,8 @@
 	}
 
 	/* Initiate cleanup of all endpoints */
-	//__endpt_mgr_remove_all( p_port );
-	__endpt_mgr_clear_all( p_port );
+	__endpt_mgr_remove_all( p_port );
+	
 	IPOIB_EXIT( IPOIB_DBG_INIT );
 }
 
--- W:\work\clean\ulp\ipoib\kernel\ipoib_adapter.c	Mon Apr 24
15:54:04 2006
+++ W:\work\OpenIB\ulp\ipoib\kernel\ipoib_adapter.c	Sun Apr 23
09:05:59 2006
@@ -505,8 +505,7 @@
 	}
 
 	IPOIB_TRACE( IPOIB_DBG_INFO,
-		("p_pnp_rec->pnp_event = 0x%x state 0x%x guid %I64x \n",
-		p_pnp_rec->pnp_event,
p_adapter->state,p_pnp_rec->guid));
+		("p_pnp_rec->pnp_event = 0x%x\n",p_pnp_rec->pnp_event));
 
 	switch( p_pnp_rec->pnp_event )
 	{
@@ -575,7 +574,7 @@
 		break;
 
 	case IB_PNP_PORT_ARMED:
-		status = IB_SUCCESS;    // Temporary fix for a bug when
open sm is down and up again
+		status = IB_SUCCESS;
 		break;
 
 	case IB_PNP_PORT_INIT:
@@ -646,27 +645,21 @@
 		{
 		case IB_PNP_PORT_DOWN:
 			p_adapter->state = IB_PNP_PORT_INIT;
-			IPOIB_TRACE( IPOIB_DBG_INFO, ("old state down
move state to init!\n") );
 			break;
 
 		default:
 			p_adapter->state = IB_PNP_PORT_DOWN;
-			IPOIB_TRACE( IPOIB_DBG_INFO, ("old state default
move state to down!\n") );
 		}
 		cl_obj_unlock( &p_adapter->obj );
 		
 		status = IB_SUCCESS;
 		if( p_adapter->registering )
-		{
-			IPOIB_TRACE( IPOIB_DBG_INFO, ("break
registering!!!!!!!!\n") );
 			break;
-		}
 
 		switch( old_state )
 		{
 		case IB_PNP_PORT_ACTIVE:
 		case IB_PNP_PORT_INIT:
-			IPOIB_TRACE( IPOIB_DBG_INFO, ("old state active
or init !\n") );
 			NdisMIndicateStatus( p_adapter->h_adapter,
 				NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 );
 			NdisMIndicateStatusComplete(
p_adapter->h_adapter );
@@ -674,17 +667,10 @@
 			IPOIB_TRACE( IPOIB_DBG_INFO, ("Link DOWN!\n") );
 
 			ipoib_port_down( p_adapter->p_port );
-			cl_obj_lock( &p_adapter->obj );
-			p_adapter->state = IB_PNP_PORT_INIT;
-			cl_obj_unlock( &p_adapter->obj );
 			/* Fall through. */
-			
+
 		case IB_PNP_PORT_DOWN:
-			IPOIB_TRACE( IPOIB_DBG_INFO, ("old state down
port up !\n") );			
 			ipoib_port_up( p_adapter->p_port,
(ib_pnp_port_rec_t*)p_pnp_rec );
-			break;
-		default :
-			IPOIB_TRACE( IPOIB_DBG_INFO, ("old state default
do nothing !\n") );
 		}
 		break;
 	}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoib_client_rereg2.patch
Type: application/octet-stream
Size: 4927 bytes
Desc: ipoib_client_rereg2.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20060424/e78964a1/attachment.obj>


More information about the ofw mailing list