From patchwork Fri Aug 5 23:29:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Manderscheid X-Patchwork-Id: 1039582 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p75NTm91003060 for ; Fri, 5 Aug 2011 23:29:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752883Ab1HEX3q (ORCPT ); Fri, 5 Aug 2011 19:29:46 -0400 Received: from quartz.orcorp.ca ([139.142.54.143]:47967 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752287Ab1HEX3p (ORCPT ); Fri, 5 Aug 2011 19:29:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=From:Subject:cc:To:Message-Id:Date; bh=F14BGY+HducaoaiKRTxhBK1pXfsabUtLVsKmhO1XeHM=; b=3evOAidSei390sUaR5m0VEEqcqwAjOKq2Xi1ErGecXFdvMbV9i/xZlgW4TP/TGah+Q/Ci2O5wd+unMDB9cbI1cBcgEE4x3/ApG4cgCY5fxdsrR5CUL74i4ianWzjbibInNpqW8xdoJc2xsoScsVsTKllD8hswbkR8AohMj+vKno=; Received: from [10.0.0.193] (helo=rvml.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1QpTpp-0002yt-GY; Fri, 05 Aug 2011 17:29:45 -0600 Received: from rvm by rvml.edm.orcorp.ca with local (Exim 4.72) (envelope-from ) id 1QpTpp-00026I-7p; Fri, 05 Aug 2011 17:29:45 -0600 Date: Fri, 05 Aug 2011 17:29:45 -0600 Message-Id: To: alexne@mellanox.com cc: linux-rdma@vger.kernel.org Subject: [PATCH] ibsim: support LID portions of directed-route SMPs From: Rolf Manderscheid X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.193 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.6 (demeter1.kernel.org [140.211.167.41]); Fri, 05 Aug 2011 23:29:49 +0000 (UTC) Heed the DRSLID and DRDLID fields in DR SMPs. Signed-off-by: Rolf Manderscheid --- ibsim/sim_mad.c | 35 +++++++++++++++++++++++++---------- 1 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c index 61d4866..9396ca3 100644 --- a/ibsim/sim_mad.c +++ b/ibsim/sim_mad.c @@ -152,11 +152,8 @@ static int decode_sim_MAD(Client * cl, struct sim_request * r, ib_rpc_t * rpc, if (rpc->mgtclass == 0x81) { // direct route // word 9 - if (mad_get_field(buf, 0, IB_DRSMP_DRDLID_F) != 0xffff || - mad_get_field(buf, 0, IB_DRSMP_DRSLID_F) != 0xffff) { - IBWARN("dr[ds]lids are used (not supported)"); - return -1; - } + path->drslid = mad_get_field(buf, 0, IB_DRSMP_DRSLID_F); + path->drdlid = mad_get_field(buf, 0, IB_DRSMP_DRDLID_F); // bytes 128 - 256 if (!response) mad_get_array(buf, 0, IB_DRSMP_PATH_F, path->p); @@ -1113,11 +1110,27 @@ static Port *direct_route_out_MAD(Port * port, ib_dr_path_t * path) static Port *route_MAD(Port * port, int response, int lid, ib_dr_path_t * path) { - if (lid >= 0 && lid < 0xffff) - return lid_route_MAD(port, lid); + if (lid >= 0 && lid < 0xffff) { + port = lid_route_MAD(port, lid); + if (!port) + return NULL; + if (!path) + return port; + } else if (!path) + return NULL; // permissive LID with no DR + + if (response) { + port = direct_route_in_MAD(port, path); + lid = path->drslid; + } else { + port = direct_route_out_MAD(port, path); + lid = path->drdlid; + } - return response ? direct_route_in_MAD(port, path) : - direct_route_out_MAD(port, path); + if (port && lid >= 0 && lid < 0xffff) + port = lid_route_MAD(port, lid); + + return port; } static Smpfn *get_handle_fn(ib_rpc_t rpc, int response) @@ -1176,7 +1189,9 @@ int process_packet(Client * cl, void *p, int size, Client ** dcl) return 0; } - if (!(port = route_MAD(cl->port, response, ntohs(r->dlid), &path))) { + port = route_MAD(cl->port, response, ntohs(r->dlid), + rpc.mgtclass == 0x81 ? &path : NULL); + if (!port) { IBWARN("routing failed: no route to dest lid %u path %s", ntohs(r->dlid), pathstr(0, &path)); goto _dropped;