From patchwork Tue Dec 22 11:37:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 69257 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBMBYEmk031856 for ; Tue, 22 Dec 2009 11:34:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751818AbZLVLeN (ORCPT ); Tue, 22 Dec 2009 06:34:13 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751580AbZLVLeN (ORCPT ); Tue, 22 Dec 2009 06:34:13 -0500 Received: from mail-fx0-f213.google.com ([209.85.220.213]:46804 "EHLO mail-fx0-f213.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818AbZLVLeK (ORCPT ); Tue, 22 Dec 2009 06:34:10 -0500 Received: by fxm5 with SMTP id 5so5761792fxm.28 for ; Tue, 22 Dec 2009 03:34:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=pzMVRnSkCtCvNM55iEo3XTlK4MYGw9nOUAEspEFXNpM=; b=jdC7CVPr5+NYFmHW/B+k07liHN0Liara8SQevjgqzu3ib73vis6HJsQKT2xVeY/HkG CjynR6gdUW2otgre3AXRZ1gDRtwdr78pTB5WWRJJS1i3kIzBX29sClvBFavFWGPdpHOf A0GrUHO+EQXIDGbxO5v6agbPrEe2CFAqU6uYo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=sKyxtP97K/0qRyo2xrTY3eKZlg/QtE7jcOun8NHT+k4X9ic6e2BILSyXsttA+yqJgO Zl//GTp0WU4nXSFWiggrqX6AM5zeso3cxIGXuU7IJmBTi0ijKAbnbLffl5fppIJLP7qK wZAUXD8AazJKLv4XHFBbJXnDHp+rF+IiN2qJs= Received: by 10.103.84.15 with SMTP id m15mr4071415mul.105.1261481646735; Tue, 22 Dec 2009 03:34:06 -0800 (PST) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id j2sm6983782mue.5.2009.12.22.03.34.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 22 Dec 2009 03:34:06 -0800 (PST) Received: by me.localdomain (Postfix, from userid 1000) id 82C8F11DF8; Tue, 22 Dec 2009 13:37:01 +0200 (IST) Date: Tue, 22 Dec 2009 13:37:01 +0200 From: Sasha Khapyorsky To: linux-rdma Cc: Hal Rosenstock , Ira Weiny Subject: [PATCH] opensm/osm_sa_path_record.c: MGID must be specified explicitly Message-ID: <20091222113701.GC26940@me> References: <20091214164334.064102f0.weiny2@llnl.gov> <20091215170317.GV5262@me> <20091215171532.GA8288@obsidianresearch.com> <20091215091819.c217cf36.weiny2@llnl.gov> <20091215185511.3ae458cc.weiny2@llnl.gov> <20091217181800.a1ee6b9b.weiny2@llnl.gov> <20091220195710.GA18524@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091220195710.GA18524@me> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c index fbeef03..082a41d 100644 --- a/opensm/opensm/osm_sa_path_record.c +++ b/opensm/opensm/osm_sa_path_record.c @@ -1401,34 +1401,6 @@ static void pr_rcv_process_pair(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, OSM_LOG_EXIT(sa->p_log); } -static osm_mgrp_t *pr_get_mgrp(IN osm_sa_t * sa, IN const osm_madw_t * p_madw) -{ - ib_path_rec_t *p_pr; - const ib_sa_mad_t *p_sa_mad; - osm_mgrp_t *mgrp; - - p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad); - - if (!(p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID)) { - OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, - "discard multicast target SA PR with wildcarded MGID"); - return NULL; - } - - mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &p_pr->dgid); - if (!mgrp) { - char gid_str[INET6_ADDRSTRLEN]; - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F09: " - "No MC group found for PathRecord destination GID %s\n", - inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str, - sizeof gid_str)); - return NULL; - } - - return mgrp; -} - static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, IN const osm_mgrp_t * p_mgrp) @@ -1510,47 +1482,11 @@ Exit: return status; } -static int pr_rcv_check_mcast_dest(osm_sa_t * sa, IN const osm_madw_t * p_madw) -{ - const ib_path_rec_t *p_pr; - const ib_sa_mad_t *p_sa_mad; - ib_net64_t comp_mask; - int is_multicast = 0; - - OSM_LOG_ENTER(sa->p_log); - - p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad); - - comp_mask = p_sa_mad->comp_mask; - - if (comp_mask & IB_PR_COMPMASK_DGID) { - is_multicast = ib_gid_is_multicast(&p_pr->dgid); - if (!is_multicast) - goto Exit; - } - - if (comp_mask & IB_PR_COMPMASK_DLID) { - if (cl_ntoh16(p_pr->dlid) >= IB_LID_MCAST_START_HO && - cl_ntoh16(p_pr->dlid) <= IB_LID_MCAST_END_HO) - is_multicast = 1; - else if (is_multicast) { - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F12: " - "PathRecord request indicates MGID but not MLID\n"); - is_multicast = -1; - } - } - -Exit: - OSM_LOG_EXIT(sa->p_log); - return is_multicast; -} - void osm_pr_rcv_process(IN void *context, IN void *data) { osm_sa_t *sa = context; osm_madw_t *p_madw = data; - const ib_path_rec_t *p_pr; + ib_path_rec_t *p_pr; const ib_sa_mad_t *p_sa_mad; const osm_port_t *p_src_port; const osm_port_t *p_dest_port; @@ -1558,7 +1494,6 @@ void osm_pr_rcv_process(IN void *context, IN void *data) ib_gid_t dgid; ib_net16_t sa_status; osm_port_t *requester_port; - int ret; OSM_LOG_ENTER(sa->p_log); @@ -1601,21 +1536,14 @@ void osm_pr_rcv_process(IN void *context, IN void *data) cl_plock_acquire(sa->p_lock); /* Handle multicast destinations separately */ - if ((ret = pr_rcv_check_mcast_dest(sa, p_madw)) < 0) { - /* Multicast DGID with unicast DLID */ - cl_plock_release(sa->p_lock); - osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_INVALID_FIELD); - goto Exit; - } - - if (ret > 0) + if ((p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID) && + ib_gid_is_multicast(&p_pr->dgid)); goto McastDest; OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unicast destination requested\n"); sa_status = pr_rcv_get_end_points(sa, p_madw, &p_src_port, &p_dest_port, &dgid); - if (sa_status == IB_SA_MAD_STATUS_SUCCESS) { /* What happens next depends on the type of endpoint information @@ -1660,9 +1588,15 @@ McastDest: uint8_t hop_limit; /* First, get the MC info */ - p_mgrp = pr_get_mgrp(sa, p_madw); - if (!p_mgrp) + p_mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &p_pr->dgid); + if (!p_mgrp) { + char gid_str[INET6_ADDRSTRLEN]; + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F09: " + "No MC group found for PathRecord destination GID %s\n", + inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str, + sizeof gid_str)); goto Unlock; + } /* Make sure the rest of the PathRecord matches the MC group attributes */ status = pr_match_mgrp_attributes(sa, p_madw, p_mgrp);