--- core/al/kernel/al_ioc_pnp.c	Tue Jun 07 13:41:54 2011
+++ core/al/kernel/al_ioc_pnp.c	Tue Jun 07 13:35:54 2011
@@ -294,7 +294,6 @@
 	cl_async_proc_item_t	async_item;
 	sweep_state_t			state;
 	ioc_pnp_svc_t			*p_svc;
-	atomic32_t				query_cnt;
 	cl_fmap_t				iou_map;
 
 }	ioc_sweep_results_t;
@@ -313,8 +312,12 @@
 ioc_pnp_mgr_t	*gp_ioc_pnp = NULL;
 uint32_t		g_ioc_query_timeout = 250;
 uint32_t		g_ioc_query_retries = 4;
-uint32_t		g_ioc_poll_interval = 30000;
-
+uint32_t		g_ioc_poll_interval = 1;
+					/* 0 == no IOC polling
+					 * 1 == IOC poll on demand (IB_PNP_SM_CHANGE, IB_PNP_PORT_ACTIVE,
+					 *			QUERY_DEVICE_RELATIONS for device 'IB Bus')
+					 * > 1 == poll interval in millisecond units.
+					 */
 
 
 /******************************************************************************
@@ -1204,6 +1207,24 @@
 }
 
 
+void
+ioc_pnp_request_ioc_rescan(void)
+{
+	ib_api_status_t	status;
+
+	AL_ENTER( AL_DBG_PNP );
+
+	CL_ASSERT( gp_ioc_pnp );
+	if ( g_ioc_poll_interval == 1 && !gp_ioc_pnp->query_cnt )
+	{
+		AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Requesting IOC rescan\n") );
+		status = cl_timer_start( &gp_ioc_pnp->sweep_timer, 50 );
+		CL_ASSERT( status == CL_SUCCESS );
+	}
+	AL_EXIT( AL_DBG_PNP );
+}
+
+
 /*
  * PnP callback for port event notifications.
  */
@@ -1213,12 +1234,14 @@
 {
 	ib_api_status_t	status = IB_SUCCESS;
 	cl_status_t		cl_status;
+#if DBG
+	const char		*evt = ib_get_pnp_event_str( p_pnp_rec->pnp_event );
+#endif
 
 	AL_ENTER( AL_DBG_PNP );
 
 	AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_PNP,
-		("p_pnp_rec->pnp_event = 0x%x (%s)\n",
-		p_pnp_rec->pnp_event, ib_get_pnp_event_str( p_pnp_rec->pnp_event )) );
+		("p_pnp_rec->pnp_event = 0x%x (%s)\n", p_pnp_rec->pnp_event, evt) );
 
 	switch( p_pnp_rec->pnp_event )
 	{
@@ -1257,8 +1280,19 @@
 		((ioc_pnp_svc_t*)p_pnp_rec->context)->obj.pfn_destroy(
 			&((ioc_pnp_svc_t*)p_pnp_rec->context)->obj, NULL );
 		p_pnp_rec->context = NULL;
+		break;
+
+	case IB_PNP_IOU_ADD:
+	case IB_PNP_IOU_REMOVE:
+	case IB_PNP_IOC_ADD:
+	case IB_PNP_IOC_REMOVE:
+	case IB_PNP_IOC_PATH_ADD:
+	case IB_PNP_IOC_PATH_REMOVE:
+		AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_PNP, ("!Handled PNP Event %s\n",evt));
+		break;
 
 	default:
+		AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Ignored PNP Event %s\n",evt));
 		break;	/* Ignore other PNP events. */
 	}
 
@@ -2630,11 +2664,14 @@
 	__remove_ious( &old_ious );
 	CL_ASSERT( !cl_fmap_count( &old_ious ) );
 
-	/* Reset the sweep timer. */
-	if( g_ioc_poll_interval )
+	/* Reset the sweep timer.
+	 * 0 == No IOC polling.
+	 * 1 == IOC poll on demand.
+	 * > 1 == IOC poll every g_ioc_poll_interval milliseconds.
+	 */
+	if( g_ioc_poll_interval > 1)
 	{
-		status = cl_timer_start(
-			&gp_ioc_pnp->sweep_timer, g_ioc_poll_interval );
+		status = cl_timer_start( &gp_ioc_pnp->sweep_timer, g_ioc_poll_interval );
 		CL_ASSERT( status == CL_SUCCESS );
 	}
 
@@ -3045,8 +3082,7 @@
 	else
 	{
 		/* Report the IOU to all clients registered for IOU events. */
-		cl_qlist_find_from_head( &gp_ioc_pnp->iou_reg_list,
-			__notify_users, &event );
+		cl_qlist_find_from_head( &gp_ioc_pnp->iou_reg_list, __notify_users, &event );
 
 		/* Report IOCs - this will in turn report the paths. */
 		__add_iocs( p_iou, &p_iou->ioc_map, NULL );
