From patchwork Wed Mar 10 18:06:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Schutt X-Patchwork-Id: 84657 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 o2AI7eZS024931 for ; Wed, 10 Mar 2010 18:07:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932623Ab0CJSHp (ORCPT ); Wed, 10 Mar 2010 13:07:45 -0500 Received: from sentry-three.sandia.gov ([132.175.109.17]:52191 "EHLO sentry-three.sandia.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932619Ab0CJSHi (ORCPT ); Wed, 10 Mar 2010 13:07:38 -0500 X-WSS-ID: 0KZ2VOK-0C-MM0-02 X-M-MSG: Received: from sentry.sandia.gov (mm03snlnto.sandia.gov [132.175.109.20]) by sentry-three.sandia.gov (Postfix) with ESMTP id 19D664D5674; Wed, 10 Mar 2010 11:07:32 -0700 (MST) Received: from [132.175.109.1] by sentry.sandia.gov with ESMTP (SMTP Relay 01 (Email Firewall v6.3.2)); Wed, 10 Mar 2010 11:07:27 -0700 X-Server-Uuid: AF72F651-81B1-4134-BA8C-A8E1A4E620FF Received: from localhost.localdomain (jast01.sandia.gov [134.253.4.112]) by mailgate.sandia.gov (8.14.1/8.14.1) with ESMTP id o2AI7OpE016900; Wed, 10 Mar 2010 11:07:26 -0700 From: "Jim Schutt" To: linux-rdma@vger.kernel.org cc: sashak@voltaire.com, eitan@mellanox.co.il, jaschut@sandia.gov Subject: [PATCH v2 03/15] opensm: Allow the routing engine to participate in path SL calculations. Date: Wed, 10 Mar 2010 11:06:45 -0700 Message-ID: <1268244416-20351-4-git-send-email-jaschut@sandia.gov> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1268244416-20351-1-git-send-email-jaschut@sandia.gov> References: <1268244416-20351-1-git-send-email-jaschut@sandia.gov> X-PMX-Version: 5.5.9.388399, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2010.3.10.175422 X-PerlMx-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=20100310180727; ID=1; SEV=2.3.1; DFV=B2010031017; IFV=NA; AIF=B2010031017; RPD=5.03.0010; ENG=NA; RPDID=7374723D303030312E30413031303230382E34423937444644462E303035373A534346535441543838363133332C73733D312C6667733D30; CAT=NONE; CON=NONE; SIG=AAAAAAAAAAAAAAAAAAAAAAAAfQ== X-MMS-Spam-Filter-ID: B2010031017_5.03.0010 MIME-Version: 1.0 X-WSS-ID: 678900550JG908644-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]); Wed, 10 Mar 2010 18:07: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 aaeebc7..02d6ec8 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, smlid; 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; } @@ -81,8 +83,9 @@ static uint8_t link_mgr_get_smsl(IN osm_sm_t * sm, IN osm_physp_t * p_physp) p_src_port = cl_ptr_vector_get(&sm->p_subn->port_lid_tbl, cl_ntoh16(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 d88832b..b55d94c 100644 --- a/opensm/opensm/osm_sa_path_record.c +++ b/opensm/opensm/osm_sa_path_record.c @@ -161,6 +161,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; @@ -177,7 +178,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; OSM_LOG_ENTER(sa->p_log); @@ -188,6 +188,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); @@ -646,9 +647,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 @@ -665,26 +663,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; @@ -725,6 +707,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 626887f..bbba6ee 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;