opensm: fix search common pkeys
PATCH 1/1 opensm: fix search common pkeys
Fixing search common pkey algorithm, due to changes in pkeys table when using allow_both_pkeys = TRUE
--- include/opensm/osm_pkey.h | 17 +++++++++++-- opensm/osm_inform.c | 3 +- opensm/osm_pkey.c | 49 ++++++++++++++++++++++++++++++++++---- opensm/osm_sa_guidinfo_record.c | 7 +++-- opensm/osm_sa_informinfo.c | 9 ++++-- opensm/osm_sa_lft_record.c | 3 +- opensm/osm_sa_link_record.c | 9 ++++-- opensm/osm_sa_mcmember_record.c | 3 +- opensm/osm_sa_mft_record.c | 3 +- opensm/osm_sa_multipath_record.c | 15 +++++++---- opensm/osm_sa_node_record.c | 3 +- opensm/osm_sa_path_record.c | 15 +++++++---- opensm/osm_sa_pkey_record.c | 4 +- opensm/osm_sa_portinfo_record.c | 8 +++--- opensm/osm_sa_slvl_record.c | 7 +++-- opensm/osm_sa_sminfo_record.c | 3 +- opensm/osm_sa_sw_info_record.c | 3 +- opensm/osm_sa_vlarb_record.c | 8 +++--- 18 files changed, 122 insertions(+), 47 deletions(-)
include/opensm/osm_pkey.h +14 -3
@@ -541,7 +541,8 @@ boolean_t osm_physp_share_this_pkey(IN const struct osm_physp * p_physp1,* SYNOPSIS */ ib_net16_t osm_physp_find_common_pkey(IN const struct osm_physp *p_physp1, - IN const struct osm_physp *p_physp2); + IN const struct osm_physp *p_physp2, + IN boolean_t allow_both_pkeys);/* * PARAMETERS *
@@ -551,6 +552,10 @@ ib_net16_t osm_physp_find_common_pkey(IN const struct osm_physp *p_physp1,* p_physp2 * [in] Pointer to an osm_physp_t object. * +* allow_both_pkeys +* [in] Whether both full and limited membership on same partition +* are allowed +* * RETURN VALUES * Returns value of first shared P_Key or INVALID P_Key (0x0) if not * found.
@@ -585,7 +590,8 @@ ib_net16_t osm_physp_find_common_pkey(IN const struct osm_physp *p_physp1,*/ boolean_t osm_physp_share_pkey(IN osm_log_t * p_log, IN const struct osm_physp * p_physp_1, - IN const struct osm_physp * p_physp_2); + IN const struct osm_physp * p_physp_2, + IN boolean_t allow_both_pkeys);/* * PARAMETERS
@@ -598,6 +604,10 @@ boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,* p_physp_2 * [in] Pointer to an osm_physp_t object. * +* allow_both_pkeys +* [in] Whether both full and limited membership on same partition +* are allowed +* * RETURN VALUES * Returns TRUE if the 2 physical ports are matching. * FALSE otherwise.
@@ -632,7 +642,8 @@ boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,*/ boolean_t osm_port_share_pkey(IN osm_log_t * p_log, IN const struct osm_port * p_port_1, - IN const struct osm_port * p_port_2); + IN const struct osm_port * p_port_2, + IN boolean_t allow_both_pkeys);/* * PARAMETERS
opensm/osm_inform.c +2 -1
@@ -415,7 +415,8 @@ static int is_access_permitted(osm_infr_t *p_infr_rec, } -if (osm_port_share_pkey (p_log, p_src_port, p_dest_port) == FALSE) { +if (osm_port_share_pkey (p_log, p_src_port, p_dest_port, + p_subn->opt.allow_both_pkeys) == FALSE) {OSM_LOG (p_log,OSM_LOG_DEBUG ,"Mismatch by Pkey\n" );/* According to o13-17.1.2 - If this informInfo does not have lid_range_begin of 0xFFFF,
opensm/osm_pkey.c +44 -5
90 lines not on this page · raw message
opensm/osm_sa_guidinfo_record.c +4 -3
@@ -155,7 +155,8 @@ static void sa_gir_create_gir(IN osm_sa_t * sa, IN osm_node_t * p_node,/* Check to see if the found p_physp and the requester physp share a pkey. If not, continue */ -if (!osm_physp_share_pkey (sa->p_log, p_physp, p_req_physp)) +if (!osm_physp_share_pkey (sa->p_log, p_physp, p_req_physp, + sa->p_subn->opt.allow_both_pkeys))continue ; port_guid =osm_physp_get_port_guid (p_physp);
@@ -777,8 +778,8 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)osm_sa_send_error (sa, p_madw,IB_SA_MAD_STATUS_NO_RECORDS ); goto Exit; } -if (!osm_physp_share_pkey (sa->p_log, p_req_physp, - p_port->p_physp)) +if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_port->p_physp, + sa->p_subn->opt.allow_both_pkeys)) goto Exit;CL_PLOCK_EXCL_ACQUIRE (sa->p_lock);if (p_rcvd_mad->method ==IB_MAD_METHOD_SET )
opensm/osm_sa_informinfo.c +6 -3
@@ -116,7 +116,8 @@ static boolean_t validate_ports_access_rights(IN osm_sa_t * sa,/* make sure that the requester and destination port can access each other according to the current partitioning. */ if (!osm_physp_share_pkey - (sa->p_log, p_port->p_physp, p_requester_physp)) { + (sa->p_log, p_port->p_physp, p_requester_physp, + sa->p_subn->opt.allow_both_pkeys)) {OSM_LOG (sa->p_log,OSM_LOG_DEBUG ,"port and requester don't share pkey\n" ); valid = FALSE;
@@ -165,7 +166,8 @@ static boolean_t validate_ports_access_rights(IN osm_sa_t * sa,/* make sure that the requester and destination port can access each other according to the current partitioning. */ if (!osm_physp_share_pkey - (sa->p_log, p_port->p_physp, p_requester_physp)) { + (sa->p_log, p_port->p_physp, p_requester_physp, + sa->p_subn->opt.allow_both_pkeys)) {OSM_LOG (sa->p_log,OSM_LOG_DEBUG ,"port and requester don't share pkey\n" ); valid = FALSE;
@@ -273,7 +275,8 @@ static void sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa, p_subscriber_physp = p_subscriber_port->p_physp;/* make sure that the requester and subscriber port can access each other according to the current partitioning. */ -if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_subscriber_physp)) { +if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_subscriber_physp, + sa->p_subn->opt.allow_both_pkeys)) {OSM_LOG (sa->p_log,OSM_LOG_DEBUG ,"requester and subscriber ports don't share pkey\n" ); goto Exit;
opensm/osm_sa_lft_record.c +2 -1
@@ -139,7 +139,8 @@ static void lftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt) cl_ntoh64(p_sw->p_node->node_info.node_guid));return ; } -if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_physp)) +if (!osm_physp_share_pkey (sa->p_log, p_req_physp, + p_physp, sa->p_subn->opt.allow_both_pkeys))return ;/* get the port 0 of the switch */
opensm/osm_sa_link_record.c +6 -3
@@ -137,17 +137,20 @@ static void lr_rcv_get_physp_link(IN osm_sa_t * sa,/* Check that the p_src_physp, p_dest_physp and p_req_physp all share a pkey (doesn't have to be the same p_key). */ -if (!osm_physp_share_pkey (sa->p_log, p_src_physp, p_dest_physp)) { +if (!osm_physp_share_pkey (sa->p_log, p_src_physp, p_dest_physp, + sa->p_subn->opt.allow_both_pkeys)) {OSM_LOG (sa->p_log,OSM_LOG_DEBUG ,"Source and Dest PhysPorts do not share PKey\n" ); goto Exit; } -if (!osm_physp_share_pkey (sa->p_log, p_src_physp, p_req_physp)) { +if (!osm_physp_share_pkey (sa->p_log, p_src_physp, p_req_physp, + sa->p_subn->opt.allow_both_pkeys)) {OSM_LOG (sa->p_log,OSM_LOG_DEBUG ,"Source and Requester PhysPorts do not share PKey\n" ); goto Exit; } -if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_dest_physp)) { +if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_dest_physp, + sa->p_subn->opt.allow_both_pkeys)) {OSM_LOG (sa->p_log,OSM_LOG_DEBUG ,"Requester and Dest PhysPorts do not share PKey\n" ); goto Exit;
opensm/osm_sa_mcmember_record.c +2 -1
@@ -1016,7 +1016,8 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw) proxy = (p_physp != p_request_physp); -if (proxy && !osm_physp_share_pkey (sa->p_log, p_physp, p_request_physp)) { +if (proxy && !osm_physp_share_pkey (sa->p_log, p_physp, p_request_physp, + sa->p_subn->opt.allow_both_pkeys)) {CL_PLOCK_RELEASE (sa->p_lock);OSM_LOG (sa->p_log,OSM_LOG_VERBOSE ,"Port and requester don't share pkey\n" );
opensm/osm_sa_mft_record.c +2 -1
@@ -146,7 +146,8 @@ static void mftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt) cl_ntoh64(p_sw->p_node->node_info.node_guid));return ; } -if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_physp)) +if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_physp, + sa->p_subn->opt.allow_both_pkeys))return ;/* get the port 0 of the switch */
opensm/osm_sa_multipath_record.c +10 -5
@@ -618,7 +618,8 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa,if (comp_mask &IB_MPR_COMPMASK_RAWTRAFFIC &&cl_ntoh32 (p_mpr->hop_flow_raw) & (1 <<31 )) required_pkey = -osm_physp_find_common_pkey (p_src_physp, p_dest_physp); +osm_physp_find_common_pkey (p_src_physp, p_dest_physp, + sa->p_subn->opt.allow_both_pkeys);else if (comp_mask &IB_MPR_COMPMASK_PKEY ) {/*
@@ -700,7 +701,8 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa,* Just get any shared pkey. */ required_pkey = -osm_physp_find_common_pkey (p_src_physp, p_dest_physp); +osm_physp_find_common_pkey (p_src_physp, p_dest_physp, + sa->p_subn->opt.allow_both_pkeys);if (!required_pkey) {OSM_LOG (sa->p_log,OSM_LOG_ERROR ,"ERR 4519: " "Ports src 0x%016"PRIx64" (%s port %d) "
@@ -991,11 +993,14 @@ static uint32_t mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,/* Check that the req_port, src_port and dest_port all share a pkey. The check is done on the default physical port of the ports. */ if (osm_port_share_pkey (sa->p_log, p_req_port, - p_src_alias_guid->p_base_port) == FALSE + p_src_alias_guid->p_base_port, + sa->p_subn->opt.allow_both_pkeys) == FALSE ||osm_port_share_pkey (sa->p_log, p_req_port, - p_dest_alias_guid->p_base_port) == FALSE + p_dest_alias_guid->p_base_port, + sa->p_subn->opt.allow_both_pkeys) == FALSE ||osm_port_share_pkey (sa->p_log, p_src_alias_guid->p_base_port, - p_dest_alias_guid->p_base_port) == FALSE) + p_dest_alias_guid->p_base_port, + sa->p_subn->opt.allow_both_pkeys) == FALSE)/* One of the pairs doesn't share a pkey so the path is disqualified. */ goto Exit;
opensm/osm_sa_node_record.c +2 -1
@@ -150,7 +150,8 @@ static void nr_rcv_create_nr(IN osm_sa_t * sa, IN osm_node_t * p_node,/* Check to see if the found p_physp and the requester physp share a pkey. If not - continue */ -if (!osm_physp_share_pkey (sa->p_log, p_physp, p_req_physp)) +if (!osm_physp_share_pkey (sa->p_log, p_physp, p_req_physp, + sa->p_subn->opt.allow_both_pkeys))continue ; port_guid =osm_physp_get_port_guid (p_physp);
opensm/osm_sa_path_record.c +10 -5
@@ -631,7 +631,8 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,if ((comp_mask &IB_PR_COMPMASK_RAWTRAFFIC ) && (cl_ntoh32 (p_pr->hop_flow_raw) & (1 <<31 ))) - pkey =osm_physp_find_common_pkey (p_src_physp, p_dest_physp); + pkey =osm_physp_find_common_pkey (p_src_physp, p_dest_physp, + sa->p_subn->opt.allow_both_pkeys);else if (comp_mask &IB_PR_COMPMASK_PKEY ) {/*
@@ -705,7 +706,8 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,* Neither PR request nor QoS level have pkey. * Just get any shared pkey. */ - pkey =osm_physp_find_common_pkey (p_src_physp, p_dest_physp); + pkey =osm_physp_find_common_pkey (p_src_physp, p_dest_physp, + sa->p_subn->opt.allow_both_pkeys);if (!pkey) {OSM_LOG (sa->p_log,OSM_LOG_ERROR ,"ERR 1F1B: " "Ports src 0x%016"PRIx64" (%s port %d) and "
@@ -1020,11 +1022,14 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,/* Check that the req_port, src_port and dest_port all share a pkey. The check is done on the default physical port of the ports. */ if (osm_port_share_pkey (sa->p_log, p_req_port, - p_src_alias_guid->p_base_port) == FALSE + p_src_alias_guid->p_base_port, + sa->p_subn->opt.allow_both_pkeys) == FALSE ||osm_port_share_pkey (sa->p_log, p_req_port, - p_dest_alias_guid->p_base_port) == FALSE + p_dest_alias_guid->p_base_port, + sa->p_subn->opt.allow_both_pkeys) == FALSE ||osm_port_share_pkey (sa->p_log, p_src_alias_guid->p_base_port, - p_dest_alias_guid->p_base_port) == FALSE) + p_dest_alias_guid->p_base_port, + sa->p_subn->opt.allow_both_pkeys) == FALSE)/* One of the pairs doesn't share a pkey so the path is disqualified. */ goto Exit;
opensm/osm_sa_pkey_record.c +2 -2
@@ -171,7 +171,7 @@ static void sa_pkey_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port,with the p_req_physp. */ if (p_physp &&osm_physp_share_pkey (sa->p_log, p_req_physp, - p_physp)) + p_physp, sa->p_subn->opt.allow_both_pkeys))sa_pkey_check_physp (sa, p_physp, p_ctxt); }else { OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4603: "
@@ -191,7 +191,7 @@ static void sa_pkey_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port,/* if the requester and the p_physp don't share a pkey - continue */ if (!osm_physp_share_pkey - (sa->p_log, p_req_physp, p_physp)) + (sa->p_log, p_req_physp, p_physp, sa->p_subn->opt.allow_both_pkeys))continue ;sa_pkey_check_physp (sa, p_physp, p_ctxt);
opensm/osm_sa_portinfo_record.c +4 -4
@@ -472,8 +472,8 @@ static void sa_pir_by_comp_mask(IN osm_sa_t * sa, IN osm_node_t * p_node,/* Check that the p_physp is valid, and that the p_physp and the p_req_physp share a pkey. */ if (p_physp && -osm_physp_share_pkey (sa->p_log, p_req_physp, - p_physp)) +osm_physp_share_pkey (sa->p_log, p_req_physp, p_physp, + sa->p_subn->opt.allow_both_pkeys))sa_pir_check_physp (sa, p_physp, p_ctxt); } }else {
@@ -484,8 +484,8 @@ static void sa_pir_by_comp_mask(IN osm_sa_t * sa, IN osm_node_t * p_node,/* if the requester and the p_physp don't share a pkey - continue */ -if (!osm_physp_share_pkey - (sa->p_log, p_req_physp, p_physp)) +if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_physp, + sa->p_subn->opt.allow_both_pkeys))continue ;sa_pir_check_physp (sa, p_physp, p_ctxt);
opensm/osm_sa_slvl_record.c +4 -3
@@ -141,7 +141,8 @@ static void sa_slvl_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port, p_port->p_physp->port_num); p_out_physp = p_port->p_physp;/* check that the p_out_physp and the p_req_physp share a pkey */ -if (osm_physp_share_pkey (sa->p_log, p_req_physp, p_out_physp)) +if (osm_physp_share_pkey (sa->p_log, p_req_physp, p_out_physp, + sa->p_subn->opt.allow_both_pkeys))sa_slvl_create (sa, p_out_physp, p_ctxt,0 ); }else {if (comp_mask &IB_SLVL_COMPMASK_OUT_PORT )
@@ -173,8 +174,8 @@ static void sa_slvl_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port,/* if the requester and the p_out_physp don't share a pkey - continue */ -if (!osm_physp_share_pkey - (sa->p_log, p_req_physp, p_out_physp)) +if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_out_physp, + sa->p_subn->opt.allow_both_pkeys))continue ; sa_slvl_create(sa, p_out_physp, p_ctxt,
opensm/osm_sa_sminfo_record.c +2 -1
@@ -254,7 +254,8 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)if (!p_port || local_port == p_port) {if (FALSE ==osm_physp_share_pkey (sa->p_log, p_req_physp, - local_port->p_physp)) { + local_port->p_physp, + sa->p_subn->opt.allow_both_pkeys)) {cl_plock_release (sa->p_lock);OSM_LOG (sa->p_log,OSM_LOG_ERROR ,"ERR 2805: " "Cannot get SMInfo record due to pkey violation\n" );
opensm/osm_sa_sw_info_record.c +2 -1
@@ -136,7 +136,8 @@ static void sir_rcv_create_sir(IN osm_sa_t * sa, IN const osm_switch_t * p_sw, cl_ntoh64(p_sw->p_node->node_info.node_guid)); goto Exit; } -if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_physp)) +if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_physp, + sa->p_subn->opt.allow_both_pkeys)) goto Exit;/* get the port 0 of the switch */
opensm/osm_sa_vlarb_record.c +4 -4
@@ -164,8 +164,8 @@ static void sa_vl_arb_by_comp_mask(osm_sa_t * sa, IN const osm_port_t * p_port,/* check that the p_physp is valid, and that the requester and the p_physp share a pkey. */ if (p_physp && -osm_physp_share_pkey (sa->p_log, p_req_physp, - p_physp)) +osm_physp_share_pkey (sa->p_log, p_req_physp, p_physp, + sa->p_subn->opt.allow_both_pkeys))sa_vl_arb_check_physp (sa, p_physp, p_ctxt); }else { OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A03: "
@@ -184,8 +184,8 @@ static void sa_vl_arb_by_comp_mask(osm_sa_t * sa, IN const osm_port_t * p_port,/* if the requester and the p_physp don't share a pkey - continue */ -if (!osm_physp_share_pkey - (sa->p_log, p_req_physp, p_physp)) +if (!osm_physp_share_pkey (sa->p_log, p_req_physp, p_physp, + sa->p_subn->opt.allow_both_pkeys))continue ;sa_vl_arb_check_physp (sa, p_physp, p_ctxt);
Signature · 9 lines
1.7.7.6 -- -- Alex -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html