[ofa-general] [PATCH] opensm/osm_pkey_mgr.c: setting only outbound partition enforcement on switch

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Tue Dec 25 04:29:47 PST 2007


Fixing wrong setting of partition enforcement bits on switch ports.
When an HCA port is configured with a certain pkey, the peer port
on the switch should turn on outbound partition enforcement bit only.
Turning on the inbound enforcement will cause the switch to drop
valid packets if the HCA is partial member.

Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
 opensm/opensm/osm_pkey_mgr.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/opensm/opensm/osm_pkey_mgr.c b/opensm/opensm/osm_pkey_mgr.c
index 58eed04..209fa71 100644
--- a/opensm/opensm/osm_pkey_mgr.c
+++ b/opensm/opensm/osm_pkey_mgr.c
@@ -212,7 +212,8 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log,

 	p_pi = &p_physp->port_info;

-	if ((p_pi->vl_enforce & 0xc) == (0xc) * (enforce == TRUE)) {
+	if (((p_pi->vl_enforce & 0xc) == 0x4 && enforce) ||
+	    ((p_pi->vl_enforce & 0xc) == 0 && !enforce)) {
 		osm_log(p_log, OSM_LOG_DEBUG,
 			"pkey_mgr_enforce_partition: "
 			"No need to update PortInfo for "
@@ -227,10 +228,13 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log,
 	memcpy(payload, p_pi, sizeof(ib_port_info_t));

 	p_pi = (ib_port_info_t *) payload;
+
+	/* clearing enforcement in both directions */
+	p_pi->vl_enforce &= ~0xc;
 	if (enforce == TRUE)
-		p_pi->vl_enforce |= 0xc;
-	else
-		p_pi->vl_enforce &= ~0xc;
+		/* enforcing only in outbound direction */
+		p_pi->vl_enforce |= 0x4;
+
 	p_pi->state_info2 = 0;
 	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);

-- 
1.5.1.4




More information about the general mailing list