[ofa-general] [PATCH] opensm: rename field pkey to pkey_ix in gsi part of mad address

Sasha Khapyorsky sashak at voltaire.com
Sun Jan 20 12:06:39 PST 2008


Since this field is used for storing pkey index and not pkey value
rename it to pkey_ix in order to avoid confusions.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_madw.h           |    2 +-
 opensm/libvendor/osm_vendor_al.c           |    2 +-
 opensm/libvendor/osm_vendor_ibumad.c       |    4 ++--
 opensm/libvendor/osm_vendor_mlx_ibmgt.c    |    2 +-
 opensm/libvendor/osm_vendor_mlx_sa.c       |    2 +-
 opensm/libvendor/osm_vendor_mlx_sim.c      |    8 +-------
 opensm/libvendor/osm_vendor_mlx_ts.c       |    6 +-----
 opensm/libvendor/osm_vendor_mlx_ts_anafa.c |    8 +-------
 opensm/libvendor/osm_vendor_mtl.c          |    2 +-
 opensm/libvendor/osm_vendor_ts.c           |    8 +-------
 opensm/libvendor/osm_vendor_umadt.c        |    5 ++---
 opensm/opensm/osm_perfmgr.c                |    2 +-
 opensm/opensm/osm_sa.c                     |    9 +++++----
 13 files changed, 19 insertions(+), 41 deletions(-)

diff --git a/opensm/include/opensm/osm_madw.h b/opensm/include/opensm/osm_madw.h
index 31707ad..f957a99 100644
--- a/opensm/include/opensm/osm_madw.h
+++ b/opensm/include/opensm/osm_madw.h
@@ -385,7 +385,7 @@ typedef struct _osm_mad_addr {
 		struct _gsi {
 			ib_net32_t remote_qp;
 			ib_net32_t remote_qkey;
-			ib_net16_t pkey;
+			uint16_t pkey_ix;
 			uint8_t service_level;
 			boolean_t global_route;
 			ib_grh_t grh_info;
diff --git a/opensm/libvendor/osm_vendor_al.c b/opensm/libvendor/osm_vendor_al.c
index 34ecf30..7d497c5 100644
--- a/opensm/libvendor/osm_vendor_al.c
+++ b/opensm/libvendor/osm_vendor_al.c
@@ -294,7 +294,7 @@ __osm_al_rcv_callback(IN void *mad_svc_context, IN ib_mad_element_t * p_elem)
 	} else {
 		mad_addr.addr_type.gsi.remote_qp = p_elem->remote_qp;
 		mad_addr.addr_type.gsi.remote_qkey = p_elem->remote_qkey;
-		mad_addr.addr_type.gsi.pkey = p_elem->pkey_index;
+		mad_addr.addr_type.gsi.pkey_ix = p_elem->pkey_index;
 		mad_addr.addr_type.gsi.service_level = p_elem->remote_sl;
 		mad_addr.addr_type.gsi.global_route = FALSE;
 	}
diff --git a/opensm/libvendor/osm_vendor_ibumad.c b/opensm/libvendor/osm_vendor_ibumad.c
index 8d1f070..38c6628 100644
--- a/opensm/libvendor/osm_vendor_ibumad.c
+++ b/opensm/libvendor/osm_vendor_ibumad.c
@@ -215,7 +215,7 @@ ib_mad_addr_conv(ib_user_mad_t * umad, osm_mad_addr_t * osm_mad_addr,
 
 	osm_mad_addr->addr_type.gsi.remote_qp = ib_mad_addr->qpn;
 	osm_mad_addr->addr_type.gsi.remote_qkey = ib_mad_addr->qkey;
-	osm_mad_addr->addr_type.gsi.pkey = umad_get_pkey(umad);
+	osm_mad_addr->addr_type.gsi.pkey_ix = umad_get_pkey(umad);
 	osm_mad_addr->addr_type.gsi.service_level = ib_mad_addr->sl;
 	osm_mad_addr->addr_type.gsi.global_route = 0;	/* FIXME: handle GRH */
 	memset(&osm_mad_addr->addr_type.gsi.grh_info, 0,
@@ -1047,7 +1047,7 @@ osm_vendor_send(IN osm_bind_handle_t h_bind,
 			  p_mad_addr->addr_type.gsi.service_level,
 			  IB_QP1_WELL_KNOWN_Q_KEY);
 	umad_set_grh(p_vw->umad, 0);	/* FIXME: GRH support */
-	umad_set_pkey(p_vw->umad, p_mad_addr->addr_type.gsi.pkey);
+	umad_set_pkey(p_vw->umad, p_mad_addr->addr_type.gsi.pkey_ix);
 	if (ib_class_is_rmpp(p_mad->mgmt_class)) {	/* RMPP GSI classes     FIXME: no GRH */
 		if (!ib_rmpp_is_flag_set((ib_rmpp_mad_t *) p_sa,
 					 IB_RMPP_FLAG_ACTIVE)) {
diff --git a/opensm/libvendor/osm_vendor_mlx_ibmgt.c b/opensm/libvendor/osm_vendor_mlx_ibmgt.c
index 3841356..b3d72f7 100644
--- a/opensm/libvendor/osm_vendor_mlx_ibmgt.c
+++ b/opensm/libvendor/osm_vendor_mlx_ibmgt.c
@@ -720,7 +720,7 @@ __osmv_IBMGT_rcv_desc_to_osm_addr(IN IB_MGT_mad_rcv_desc_t * p_rcv_desc,
 		/*  since this does not seem reasonable to me I simply use the default */
 		/*  There is a TAVOR limitation that only one P_KEY is supported per  */
 		/*  QP - so QP1 must use IB_DEFAULT_PKEY */
-		p_mad_addr->addr_type.gsi.pkey = IB_DEFAULT_PKEY;
+		p_mad_addr->addr_type.gsi.pkey_ix = 0;
 		p_mad_addr->addr_type.gsi.service_level = p_rcv_desc->sl;
 
 		p_mad_addr->addr_type.gsi.global_route = p_rcv_desc->grh_flag;
diff --git a/opensm/libvendor/osm_vendor_mlx_sa.c b/opensm/libvendor/osm_vendor_mlx_sa.c
index bf44413..aeb8542 100644
--- a/opensm/libvendor/osm_vendor_mlx_sa.c
+++ b/opensm/libvendor/osm_vendor_mlx_sa.c
@@ -533,7 +533,7 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 	p_madw->mad_addr.addr_type.smi.source_lid = cl_hton16(p_bind->lid);
 	p_madw->mad_addr.addr_type.gsi.remote_qp = CL_HTON32(1);
 	p_madw->mad_addr.addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
-	p_madw->mad_addr.addr_type.gsi.pkey = IB_DEFAULT_PKEY;
+	p_madw->mad_addr.addr_type.gsi.pkey_ix = 0;
 	p_madw->resp_expected = TRUE;
 	p_madw->fail_msg = CL_DISP_MSGID_NONE;
 
diff --git a/opensm/libvendor/osm_vendor_mlx_sim.c b/opensm/libvendor/osm_vendor_mlx_sim.c
index fb5687b..c700759 100644
--- a/opensm/libvendor/osm_vendor_mlx_sim.c
+++ b/opensm/libvendor/osm_vendor_mlx_sim.c
@@ -382,13 +382,7 @@ __osmv_ibms_mad_addr_to_osm_addr(IN osm_vendor_t const *p_vend,
 		p_osm_addr->addr_type.gsi.remote_qp =
 		    cl_ntoh32(p_ibms_addr->sqpn);
 		p_osm_addr->addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
-		/*  we do have the p_osm_addr->pkey_ix but how to get the PKey by index ? */
-		/*  the only way seems to be to use VAPI_query_hca_pkey_tbl and obtain */
-		/*  the full PKey table - than go by the index. */
-		/*  since this does not seem reasonable to me I simply use the default */
-		/*  There is a TAVOR limitation that only one P_KEY is supported per */
-		/*  QP - so QP1 must use IB_DEFAULT_PKEY */
-		p_osm_addr->addr_type.gsi.pkey = IB_DEFAULT_PKEY;
+		p_osm_addr->addr_type.gsi.pkey_ix = p_ibms_addr->pkey_index;
 		p_osm_addr->addr_type.gsi.service_level = p_ibms_addr->sl;
 
 		p_osm_addr->addr_type.gsi.global_route = FALSE;
diff --git a/opensm/libvendor/osm_vendor_mlx_ts.c b/opensm/libvendor/osm_vendor_mlx_ts.c
index 7bddeed..f5ca136 100644
--- a/opensm/libvendor/osm_vendor_mlx_ts.c
+++ b/opensm/libvendor/osm_vendor_mlx_ts.c
@@ -443,13 +443,9 @@ __osmv_TOPSPIN_mad_addr_to_osm_addr(IN osm_vendor_t const *p_vend,
 		/* GSI */
 		p_mad_addr->addr_type.gsi.remote_qp = cl_ntoh32(p_mad->sqpn);
 		p_mad_addr->addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
-		/*  we do have the p_mad_addr->pkey_ix but how to get the PKey by index ? */
-		/*  the only way seems to be to use VAPI_query_hca_pkey_tbl and obtain */
-		/*  the full PKey table - than go by the index. */
-		/*  since this does not seem reasonable to me I simply use the default */
 		/*  There is a TAVOR limitation that only one P_KEY is supported per */
 		/*  QP - so QP1 must use IB_DEFAULT_PKEY */
-		p_mad_addr->addr_type.gsi.pkey = IB_DEFAULT_PKEY;
+		p_mad_addr->addr_type.gsi.pkey_ix = p_mad->pkey_index;
 		p_mad_addr->addr_type.gsi.service_level = p_mad->sl;
 
 		p_mad_addr->addr_type.gsi.global_route = FALSE;
diff --git a/opensm/libvendor/osm_vendor_mlx_ts_anafa.c b/opensm/libvendor/osm_vendor_mlx_ts_anafa.c
index 8bb3a36..9cbe1b6 100644
--- a/opensm/libvendor/osm_vendor_mlx_ts_anafa.c
+++ b/opensm/libvendor/osm_vendor_mlx_ts_anafa.c
@@ -393,13 +393,7 @@ __osmv_TOPSPIN_ANAFA_mad_addr_to_osm_addr(IN osm_vendor_t const *p_vend,
 		/* GSI */
 		p_mad_addr->addr_type.gsi.remote_qp = p_mad->sqpn;
 		p_mad_addr->addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
-		/*  we do have the p_mad_addr->pkey_ix but how to get the PKey by index ? */
-		/*  the only way seems to be to use VAPI_query_hca_pkey_tbl and obtain */
-		/*  the full PKey table - than go by the index. */
-		/*  since this does not seem reasonable to me I simply use the default */
-		/*  There is a TAVOR limitation that only one P_KEY is supported per */
-		/*  QP - so QP1 must use IB_DEFAULT_PKEY */
-		p_mad_addr->addr_type.gsi.pkey = IB_DEFAULT_PKEY;
+		p_mad_addr->addr_type.gsi.pkey_ix = p_mad->pkey_index;
 		p_mad_addr->addr_type.gsi.service_level = p_mad->sl;
 
 		p_mad_addr->addr_type.gsi.global_route = FALSE;
diff --git a/opensm/libvendor/osm_vendor_mtl.c b/opensm/libvendor/osm_vendor_mtl.c
index 8b919e4..d8f6715 100644
--- a/opensm/libvendor/osm_vendor_mtl.c
+++ b/opensm/libvendor/osm_vendor_mtl.c
@@ -114,7 +114,7 @@ __osm_mtl_conv_ibmgt_rcv_desc_to_osm_addr(IN osm_vendor_t * const p_vend,
 		/*  since this does not seem reasonable to me I simply use the default */
 		/*  There is a TAVOR limitation that only one P_KEY is supported per  */
 		/*  QP - so QP1 must use IB_DEFAULT_PKEY */
-		p_mad_addr->addr_type.gsi.pkey = IB_DEFAULT_PKEY;
+		p_mad_addr->addr_type.gsi.pkey_ix = 0;
 		p_mad_addr->addr_type.gsi.service_level = p_rcv_desc->sl;
 
 		p_mad_addr->addr_type.gsi.global_route = p_rcv_desc->grh_flag;
diff --git a/opensm/libvendor/osm_vendor_ts.c b/opensm/libvendor/osm_vendor_ts.c
index 0dad230..365d609 100644
--- a/opensm/libvendor/osm_vendor_ts.c
+++ b/opensm/libvendor/osm_vendor_ts.c
@@ -96,13 +96,7 @@ __osm_ts_conv_mad_rcv_desc_to_osm_addr(IN osm_vendor_t * const p_vend,
 		/* GSI */
 		p_mad_addr->addr_type.gsi.remote_qp = p_mad->sqpn;
 		p_mad_addr->addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
-		/*  we do have the p_mad_addr->pkey_ix but how to get the PKey by index ? */
-		/*  the only way seems to be to use VAPI_query_hca_pkey_tbl and obtain */
-		/*  the full PKey table - than go by the index. */
-		/*  since this does not seem reasonable to me I simply use the default */
-		/*  There is a TAVOR limitation that only one P_KEY is supported per */
-		/*  QP - so QP1 must use IB_DEFAULT_PKEY */
-		p_mad_addr->addr_type.gsi.pkey = IB_DEFAULT_PKEY;
+		p_mad_addr->addr_type.gsi.pkey_ix = p_mad->pkey_index;
 		p_mad_addr->addr_type.gsi.service_level = 0;	/*  HACK no way to know */
 
 		p_mad_addr->addr_type.gsi.global_route = FALSE;	/*  HACK no way to know */
diff --git a/opensm/libvendor/osm_vendor_umadt.c b/opensm/libvendor/osm_vendor_umadt.c
index e761452..b68d6c1 100644
--- a/opensm/libvendor/osm_vendor_umadt.c
+++ b/opensm/libvendor/osm_vendor_umadt.c
@@ -549,7 +549,7 @@ osm_vendor_send(IN osm_bind_handle_t h_bind,
 		    p_mad_addr->addr_type.gsi.remote_qp;
 		destAddr.AddrType.Gsi.RemoteQkey =
 		    p_mad_addr->addr_type.gsi.remote_qkey;
-		destAddr.AddrType.Gsi.PKey = p_mad_addr->addr_type.gsi.pkey;
+		destAddr.AddrType.Gsi.PKey = OSM_DEFAULT_PKEY;
 		destAddr.AddrType.Gsi.ServiceLevel =
 		    p_mad_addr->addr_type.gsi.service_level;
 		destAddr.AddrType.Gsi.GlobalRoute =
@@ -962,8 +962,7 @@ void __mad_recv_processor(IN void *context)
 			    pRecvCmp->AddressInfo.AddrType.Gsi.RemoteQpNumber;
 			osm_mad_addr.addr_type.gsi.remote_qkey =
 			    pRecvCmp->AddressInfo.AddrType.Gsi.RemoteQkey;
-			osm_mad_addr.addr_type.gsi.pkey =
-			    pRecvCmp->AddressInfo.AddrType.Gsi.PKey;
+			osm_mad_addr.addr_type.gsi.pkey_ix = 0;
 			osm_mad_addr.addr_type.gsi.service_level =
 			    pRecvCmp->AddressInfo.AddrType.Gsi.ServiceLevel;
 			osm_mad_addr.addr_type.gsi.global_route =
diff --git a/opensm/opensm/osm_perfmgr.c b/opensm/opensm/osm_perfmgr.c
index 66d919d..860a20d 100644
--- a/opensm/opensm/osm_perfmgr.c
+++ b/opensm/opensm/osm_perfmgr.c
@@ -399,7 +399,7 @@ osm_perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr, ib_net16_t dest_lid,
 	p_madw->mad_addr.addr_type.gsi.remote_qkey =
 	    cl_hton32(IB_QP1_WELL_KNOWN_Q_KEY);
 	/* FIXME what about other partitions */
-	p_madw->mad_addr.addr_type.gsi.pkey = 0;
+	p_madw->mad_addr.addr_type.gsi.pkey_ix = 0;
 	p_madw->mad_addr.addr_type.gsi.service_level = 0;
 	p_madw->mad_addr.addr_type.gsi.global_route = FALSE;
 	p_madw->resp_expected = TRUE;
diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
index 740fef5..c286259 100644
--- a/opensm/opensm/osm_sa.c
+++ b/opensm/opensm/osm_sa.c
@@ -442,7 +442,7 @@ static void sa_dump_one_inform(cl_list_item_t * p_list_item, void *cxt)
 		" qpn_resp_time_val=0x%x"
 		" node_type=0x%06x"
 		" rep_addr: lid=0x%04x path_bits=0x%02x static_rate=0x%02x"
-		" remote_qp=0x%08x remote_qkey=0x%08x pkey=0x%04x sl=0x%02x"
+		" remote_qp=0x%08x remote_qkey=0x%08x pkey_ix=0x%04x sl=0x%02x"
 		"\n\n",
 		cl_ntoh64(p_iir->subscriber_gid.unicast.prefix),
 		cl_ntoh64(p_iir->subscriber_gid.unicast.interface_id),
@@ -462,7 +462,7 @@ static void sa_dump_one_inform(cl_list_item_t * p_list_item, void *cxt)
 		p_infr->report_addr.static_rate,
 		cl_ntoh32(p_infr->report_addr.addr_type.gsi.remote_qp),
 		cl_ntoh32(p_infr->report_addr.addr_type.gsi.remote_qkey),
-		cl_ntoh16(p_infr->report_addr.addr_type.gsi.pkey),
+		p_infr->report_addr.addr_type.gsi.pkey_ix,
 		p_infr->report_addr.addr_type.gsi.service_level);
 }
 
@@ -886,6 +886,7 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
 		} else if (!strncmp(p, "InformInfo Record:", 18)) {
 			ib_inform_info_record_t i_rec;
 			osm_mad_addr_t rep_addr;
+			ib_net16_t val16;
 
 			p_mgrp = NULL;
 			memset(&i_rec, 0, sizeof(i_rec));
@@ -931,8 +932,8 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
 				    &rep_addr.addr_type.gsi.remote_qp);
 			PARSE_AHEAD(p, net32, " remote_qkey=0x",
 				    &rep_addr.addr_type.gsi.remote_qkey);
-			PARSE_AHEAD(p, net16, " pkey=0x",
-				    &rep_addr.addr_type.gsi.pkey);
+			PARSE_AHEAD(p, net16, " pkey_ix=0x", &val16);
+			rep_addr.addr_type.gsi.pkey_ix = cl_ntoh16(val16);
 			PARSE_AHEAD(p, net8, " sl=0x",
 				    &rep_addr.addr_type.gsi.service_level);
 
-- 
1.5.4.rc2.38.gd6da3




More information about the general mailing list