[ofw][patch][[ibbus]
Leonid Keller
leonid at mellanox.co.il
Mon Mar 16 09:21:55 PDT 2009
[IBBUS] Fix for hibernate in case of several child devices of IBBUS
Signed-off-by: James Yang
Index: core/bus/kernel/bus_port_mgr.c
===================================================================
--- core/bus/kernel/bus_port_mgr.c (revision 2032)
+++ core/bus/kernel/bus_port_mgr.c (working copy)
@@ -420,13 +420,12 @@
deref_al_obj( &p_ext->h_ca->obj );
}
- BUS_TRACE( BUS_DBG_PNP, ("%s Deleted device %s: PDO %p, ext %p\n",
- p_bfi->whoami, p_ext->cl_ext.vfptr_pnp_po->identity,
- p_ext->cl_ext.p_self_do, p_ext ) );
+ BUS_TRACE( BUS_DBG_PNP, ("%s Deleted device %s: PDO %p, ext %p\n",
+ p_bfi->whoami, p_ext->cl_ext.vfptr_pnp_po->identity,
+ p_ext->cl_ext.p_self_do, p_ext ) );
+ IoDeleteDevice( p_ext->cl_ext.p_self_do );
+ }
- IoDeleteDevice( p_ext->cl_ext.p_self_do );
- }
-
cl_mutex_destroy( &p_port_mgr->pdo_mutex );
cl_obj_deinit( p_obj );
cl_free( p_port_mgr );
@@ -585,7 +584,7 @@
NTSTATUS status;
cl_list_item_t *p_list_item;
bus_port_ext_t *p_port_ext;
- bus_pdo_ext_t *p_pdo_ext = NULL;
+ bus_pdo_ext_t *p_shadow_pdo_ext, *p_pdo_ext = NULL;
size_t n_devs = 0;
port_mgr_t *p_port_mgr = p_bfi->p_port_mgr;
cl_qlist_t *p_pdo_list = &p_port_mgr->port_list;
@@ -611,14 +610,14 @@
p_pdo_ext = PARENT_STRUCT( p_list_item, bus_pdo_ext_t, list_item );
p_port_ext = (bus_port_ext_t*)p_pdo_ext;
- if( p_pdo_ext->b_present && p_pdo_ext->b_hibernating &&
+ if( p_pdo_ext->b_present && p_pdo_ext->b_hibernating &&
p_pdo_ext->hca_acquired &&
(p_port_ext->port_guid.guid == p_pnp_rec->p_port_attr->port_guid) )
{
n_devs++;
break;
}
- BUS_TRACE( BUS_DBG_PNP, ("%s Skipped PDO for %s: PDO %p, ext %p, "
+ BUS_TRACE( BUS_DBG_PNP, ("%s Skipped acquire hca on PDO for %s: PDO
%p, ext %p, "
"present %d, missing %d, hibernating %d, port_guid %I64x.\n",
p_bfi->whoami,
p_pdo_ext->cl_ext.vfptr_pnp_po->identity,
@@ -654,6 +653,31 @@
p_pdo_ext->cl_ext.p_self_do,
p_pdo_ext, p_pdo_ext->b_present, p_pdo_ext->b_reported_missing,
p_pdo_ext->b_hibernating, p_port_ext->port_guid.guid ) );
+
+ for( p_list_item = cl_qlist_head( p_pdo_list );
+ p_list_item != cl_qlist_end( p_pdo_list );
+ p_list_item = cl_qlist_next( p_list_item ) )
+ {
+ p_shadow_pdo_ext = PARENT_STRUCT( p_list_item, bus_pdo_ext_t,
list_item );
+ p_port_ext = (bus_port_ext_t*)p_shadow_pdo_ext;
+
+ if( p_shadow_pdo_ext->b_present && p_shadow_pdo_ext->b_hibernating
&&
+ (p_port_ext->port_guid.guid == p_pnp_rec->p_port_attr->port_guid)
)
+ {
+ p_shadow_pdo_ext->b_hibernating = FALSE;
+ p_shadow_pdo_ext->h_ca = p_pdo_ext->h_ca;
+
+
+ BUS_TRACE( BUS_DBG_PNP, ("%s set shadow h_ca PDO for %s: PDO %p,
ext %p, "
+ "present %d, missing %d, hibernating %d, port_guid
%I64x.\n",
+ p_bfi->whoami,
+ p_shadow_pdo_ext->cl_ext.vfptr_pnp_po->identity,
+ p_shadow_pdo_ext->cl_ext.p_self_do,
+ p_shadow_pdo_ext, p_shadow_pdo_ext->b_present,
p_shadow_pdo_ext->b_reported_missing,
+ p_shadow_pdo_ext->b_hibernating, p_port_ext->port_guid.guid
) );
+ }
+ }
+
}
}
else
@@ -1144,6 +1168,10 @@
port_mgr_t *p_port_mgr;
bus_filter_t *p_bfi;
port_pnp_ctx_t *p_ctx = p_pnp_rec->pnp_rec.context;
+ cl_list_item_t *p_list_item;
+ bus_port_ext_t *p_port_ext;
+ bus_pdo_ext_t *p_pdo_ext;
+ cl_qlist_t* p_pdo_list;
BUS_ENTER( BUS_DBG_PNP );
@@ -1210,6 +1238,23 @@
}
p_ext->b_present = FALSE;
+
+ p_pdo_list = &p_port_mgr->port_list;
+
+ for( p_list_item = cl_qlist_head( p_pdo_list );
+ p_list_item != cl_qlist_end( p_pdo_list );
+ p_list_item = cl_qlist_next( p_list_item ) )
+ {
+ p_pdo_ext = PARENT_STRUCT( p_list_item, bus_pdo_ext_t, list_item );
+ p_port_ext = (bus_port_ext_t*) p_pdo_ext;
+
+ if( (p_port_ext->port_guid.guid ==
((bus_port_ext_t*)p_ext)->port_guid.guid) )
+ {
+ p_pdo_ext->b_present = FALSE;
+ }
+ }
+
+
BUS_TRACE( BUS_DBG_PNP,
("Mark removing %s: PDO %p, ext %p, present %d, missing %d .\n",
p_ext->cl_ext.vfptr_pnp_po->identity, p_ext->cl_ext.p_self_do, p_ext,
@@ -1235,6 +1280,21 @@
// after arriving IB_PNP_PORT_ADD event from IBAL
p_ext->h_ca = NULL;
+ p_pdo_list = &p_port_mgr->port_list;
+
+ for( p_list_item = cl_qlist_head( p_pdo_list );
+ p_list_item != cl_qlist_end( p_pdo_list );
+ p_list_item = cl_qlist_next( p_list_item ) )
+ {
+ p_pdo_ext = PARENT_STRUCT( p_list_item, bus_pdo_ext_t, list_item );
+ p_port_ext = (bus_port_ext_t*) p_pdo_ext;
+
+ if( p_port_ext->port_guid.guid ==
((bus_port_ext_t*)p_ext)->port_guid.guid )
+ {
+ p_pdo_ext->h_ca = NULL;
+ }
+ }
+
cl_mutex_release( &p_port_mgr->pdo_mutex );
BUS_EXIT( BUS_DBG_PNP );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090316/a3345563/attachment.html>
More information about the ofw
mailing list