From patchwork Tue Jun 15 19:53:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Schutt X-Patchwork-Id: 106316 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5FJrgMj028443 for ; Tue, 15 Jun 2010 19:53:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752324Ab0FOTxo (ORCPT ); Tue, 15 Jun 2010 15:53:44 -0400 Received: from sentry-three.sandia.gov ([132.175.109.17]:52730 "EHLO sentry-three.sandia.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752808Ab0FOTxk (ORCPT ); Tue, 15 Jun 2010 15:53:40 -0400 X-WSS-ID: 0L42N97-0C-6XO-02 X-M-MSG: Received: from sentry.sandia.gov (sentry.sandia.gov [132.175.109.20]) by sentry-three.sandia.gov (Postfix) with ESMTP id 148664D8872; Tue, 15 Jun 2010 13:53:30 -0600 (MDT) Received: from [132.175.109.1] by sentry.sandia.gov with ESMTP (SMTP Relay 01 (Email Firewall v6.3.2)); Tue, 15 Jun 2010 13:53:29 -0600 X-Server-Uuid: AF72F651-81B1-4134-BA8C-A8E1A4E620FF Received: from localhost.localdomain (sale659.sandia.gov [134.253.4.20]) by mailgate.sandia.gov (8.14.4/8.14.4) with ESMTP id o5FJrIBH028244; Tue, 15 Jun 2010 13:53:21 -0600 From: "Jim Schutt" To: linux-rdma@vger.kernel.org cc: sashak@voltaire.com, "Jim Schutt" Subject: [PATCH v3 03/17] opensm: Allow the routing engine to participate in path SL calculations. Date: Tue, 15 Jun 2010 13:53:10 -0600 Message-ID: <1276631604-29230-4-git-send-email-jaschut@sandia.gov> X-Mailer: git-send-email 1.6.2.2 In-Reply-To: <1276631604-29230-1-git-send-email-jaschut@sandia.gov> References: <1276631604-29230-1-git-send-email-jaschut@sandia.gov> X-PMX-Version: 5.5.9.395186, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2010.6.15.194814 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' TO_NO_NAME 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS ' X-TMWD-Spam-Summary: TS=20100615195330; ID=1; SEV=2.3.1; DFV=B2010061519; IFV=NA; AIF=B2010061519; RPD=5.03.0010; ENG=NA; RPDID=7374723D303030312E30413031303230312E34433137444133412E303142353A534346535441543838363133332C73733D312C6667733D30; CAT=NONE; CON=NONE; SIG=AAAAAAAAAAAAAAAAAAAAAAAAfQ== X-MMS-Spam-Filter-ID: B2010061519_5.03.0010 MIME-Version: 1.0 X-WSS-ID: 600905B32GW1265960-01-01 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 15 Jun 2010 19:53:46 +0000 (UTC) diff --git a/opensm/include/opensm/osm_opensm.h b/opensm/include/opensm/osm_opensm.h index 25a6f90..734a6db 100644 --- a/opensm/include/opensm/osm_opensm.h +++ b/opensm/include/opensm/osm_opensm.h @@ -129,6 +129,9 @@ struct osm_routing_engine { void (*update_sl2vl)(void *context, IN osm_physp_t *port, IN uint8_t in_port_num, IN uint8_t out_port_num, IN OUT ib_slvl_table_t *t); + uint8_t (*path_sl)(void *context, IN uint8_t path_sl_hint, + IN const osm_port_t *src_port, + IN const osm_port_t *dst_port); void (*delete) (void *context); struct osm_routing_engine *next; }; @@ -159,6 +162,9 @@ struct osm_routing_engine { * which part of the SL2VL map to update. For router/HCA ports, * in_port_num/out_port_num should be ignored. * +* path_sl +* The callback for computing path SL. +* * delete * The delete method, may be used for routing engine * internals cleanup. diff --git a/opensm/include/opensm/osm_ucast_lash.h b/opensm/include/opensm/osm_ucast_lash.h index 9e15d38..dd90d5d 100644 --- a/opensm/include/opensm/osm_ucast_lash.h +++ b/opensm/include/opensm/osm_ucast_lash.h @@ -94,7 +94,4 @@ typedef struct _lash { int ***virtual_location; } lash_t; -uint8_t osm_get_lash_sl(osm_opensm_t * p_osm, const osm_port_t * p_src_port, - const osm_port_t * p_dst_port); - #endif diff --git a/opensm/opensm/osm_link_mgr.c b/opensm/opensm/osm_link_mgr.c index c309916..e446e16 100644 --- a/opensm/opensm/osm_link_mgr.c +++ b/opensm/opensm/osm_link_mgr.c @@ -53,21 +53,23 @@ #include #include #include -#include static uint8_t link_mgr_get_smsl(IN osm_sm_t * sm, IN osm_physp_t * p_physp) { osm_opensm_t *p_osm = sm->p_subn->p_osm; + struct osm_routing_engine *re = p_osm->routing_engine_used; const osm_port_t *p_sm_port, *p_src_port; ib_net16_t slid; uint8_t sl; OSM_LOG_ENTER(sm->p_log); - if (!(p_osm->routing_engine_used && - p_osm->routing_engine_used->type == OSM_ROUTING_ENGINE_TYPE_LASH && + if (!(re && re->path_sl && (slid = osm_physp_get_base_lid(p_physp)))) { - /* Use default SL if lash routing is not used */ + /* + * Use default SL if routing engine does not provide a + * path SL lookup callback. + */ OSM_LOG_EXIT(sm->p_log); return sm->p_subn->opt.sm_sl; } @@ -78,8 +80,9 @@ static uint8_t link_mgr_get_smsl(IN osm_sm_t * sm, IN osm_physp_t * p_physp) /* Find osm_port of the source = p_physp */ p_src_port = osm_get_port_by_lid(sm->p_subn, slid); - /* Call lash to find proper SL */ - sl = osm_get_lash_sl(p_osm, p_src_port, p_sm_port); + /* Call into routing engine to find proper SL */ + sl = re->path_sl(re->context, sm->p_subn->opt.sm_sl, + p_src_port, p_sm_port); OSM_LOG_EXIT(sm->p_log); return sl; diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c index 093c70d..a323671 100644 --- a/opensm/opensm/osm_sa_path_record.c +++ b/opensm/opensm/osm_sa_path_record.c @@ -164,6 +164,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, const osm_physp_t *p_dest_physp; const osm_prtn_t *p_prtn = NULL; osm_opensm_t *p_osm; + struct osm_routing_engine *p_re; const ib_port_info_t *p_pi; ib_api_status_t status = IB_SUCCESS; ib_net16_t pkey; @@ -180,7 +181,6 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, ib_slvl_table_t *p_slvl_tbl = NULL; osm_qos_level_t *p_qos_level = NULL; uint16_t valid_sl_mask = 0xffff; - int is_lash; int hops = 0; OSM_LOG_ENTER(sa->p_log); @@ -192,6 +192,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, p_src_physp = p_physp; p_pi = &p_physp->port_info; p_osm = sa->p_subn->p_osm; + p_re = p_osm->routing_engine_used; mtu = ib_port_info_get_mtu_cap(p_pi); rate = ib_port_info_compute_rate(p_pi); @@ -667,9 +668,6 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, * Set PathRecord SL */ - is_lash = (p_osm->routing_engine_used && - p_osm->routing_engine_used->type == OSM_ROUTING_ENGINE_TYPE_LASH); - if (comp_mask & IB_PR_COMPMASK_SL) { /* * Specific SL was requested @@ -686,26 +684,10 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, goto Exit; } - if (is_lash - && osm_get_lash_sl(p_osm, p_src_port, p_dest_port) != sl) { - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F23: " - "Required PathRecord SL (%u) doesn't " - "match LASH SL\n", sl); - status = IB_NOT_FOUND; - goto Exit; - } - - } else if (is_lash) { - /* - * No specific SL in PathRecord request. - * If it's LASH routing - use its SL. - * slid and dest_lid are stored in network in lash. - */ - sl = osm_get_lash_sl(p_osm, p_src_port, p_dest_port); } else if (p_qos_level && p_qos_level->sl_set) { /* - * No specific SL was requested, and we're not in - * LASH routing, but there is an SL in QoS level. + * No specific SL was requested, but there is an SL in + * QoS level. */ sl = p_qos_level->sl; @@ -746,6 +728,14 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, goto Exit; } + /* + * If the routing engine wants to have a say in path SL selection, + * send the currently computed SL value as a hint and let the routing + * engine override it. + */ + if (p_re && p_re->path_sl) + sl = p_re->path_sl(p_re->context, sl, p_src_port, p_dest_port); + /* reset pkey when raw traffic */ if (comp_mask & IB_PR_COMPMASK_RAWTRAFFIC && cl_ntoh32(p_pr->hop_flow_raw) & (1 << 31)) diff --git a/opensm/opensm/osm_ucast_lash.c b/opensm/opensm/osm_ucast_lash.c index 72c4c3d..8746c37 100644 --- a/opensm/opensm/osm_ucast_lash.c +++ b/opensm/opensm/osm_ucast_lash.c @@ -1277,12 +1277,15 @@ static void lash_delete(void *context) free(p_lash); } -uint8_t osm_get_lash_sl(osm_opensm_t * p_osm, const osm_port_t * p_src_port, - const osm_port_t * p_dst_port) +static uint8_t get_lash_sl(void *context, uint8_t path_sl_hint, + const osm_port_t *p_src_port, + const osm_port_t *p_dst_port) { unsigned dst_id; unsigned src_id; osm_switch_t *p_sw; + lash_t *p_lash = context; + osm_opensm_t *p_osm = p_lash->p_osm; if (!(p_osm->routing_engine_used && p_osm->routing_engine_used->type == OSM_ROUTING_ENGINE_TYPE_LASH)) @@ -1312,6 +1315,7 @@ int osm_ucast_lash_setup(struct osm_routing_engine *r, osm_opensm_t *p_osm) r->context = p_lash; r->ucast_build_fwd_tables = lash_process; + r->path_sl = get_lash_sl; r->delete = lash_delete; return 0;